CFG Plugin2.3 Input Syntax

From FSL
Jump to: navigation, search

The MOP CFG plugin uses the following syntax, which is defined in BNF:

// BNF below is extended with {p} for zero or more and [p] for zero or one repetitions of p
// The mandatory MOP logic syntax
<CFG Name> ::= "cfg"
<CFG Syntax> ::= <Production> {"," <Production>}
<CFG State> ::= "match" | "fail"
// The auxiliary elements for the logic syntax
<Production> ::= <NonTerminal Name> "->" <Right Hand Side> {"|" <Right Hand Side>}
<Right Hand Side> ::= <NonTerminal or Event Name> { <NonTerminal or EventName> } | "epsilon"
<NonTerminal or EventName> ::= <NonTerminal Name> | <Event Name>
<NonTerminal Name> ::= <Id>

<CFG Name>

<CFG Name> instantiates <Logic Name> from the MOP Syntax. It denotes the CFG logic using the string "cfg". The GLR parsing algorithm is used.

<CFG Syntax>

<CFG Syntax> instantiates <Logic Syntax> from the MOP Syntax. It defines a context free grammar, which is composed of multiple <Production>s.

<CFG State>

<CFG State> instantiates <Logic State> from the MOP Syntax. In a CFG specification, <CFG State> can be either the special state match or fail. match corresponds to a situation wherein the trace matches the specified pattern, whereas fail occurs when the trace is not a prefix of any matching trace. The CFG monitor is unable to leave the fail state once it is entered.


A <Production> is a pair of <NonTerminal Name> and possibly several alternate <Right Hand Side>s, separated by an "->", which specifies that a given <NonTerminal Name> may expand to the <Right Hand Side>. The <NonTerminal Name> of the first production is considered to be the start symbol, which defines the root of the grammar.

<Right Hand Side>

A <Right Hand Side> can be either a string of <Nonterminal or Event Name>s or the empty string "epsilon".

<NonTerminal or Event Name>

<NonTerminal or Event Name> can match either a <NonTerminal Name> or an <Event Name>.

<NonTerminal Name>

<NonTerminal Name> is an identifier that can be used as a nonterminal.


<Events>a b</Events>
<Formula> S -> b S b | b A b | epsilon,
A -> A a | a</Formula>

This example monitors the language b^n a* b^n.

Personal tools