Notation conventions
The Apama EPL Reference describes the EPL language grammar using a pictorial form of Backus-Naur Form (BNF) notation informally termed railroad diagrams. Each diagram is a drawing that represents one rule or production of the language grammar. The diagrams show
Lexical rules — how sequences of characters are composed to form the basic elements of the language, called tokens or symbols.
Syntactic rules — how symbols are used to compose statements and other language constructs such as event definitions.
In addition to the lexical and syntactic rules, both of which have to do with a program’s structure, there are semantic rules, which have to do with meaning. For example, the operands of the mulitiplication operator (*) must be of type decimal, float or integer — this is a semantic rule. The semantic rules are described in the text that accompanies the syntax rules.
Each railroad diagram drawing is preceded by a rule name in italic text. The rule can then be referred to by its name in other diagrams.
The railroad diagram drawings consist of sequences and combinations of round and square cornered boxes connected together by "tracks" represented as lines with arrowheads that indicate the direction of travel. For example:
Example
Each diagram represents one language construct or grammar production rule and is read from left to right, following the lines as if you were on a train moving along its track. Branches can occur at various points to allow you to choose amongst several possible alternatives, to skip over optional constructions, and to go back to an earlier point to repeat certain constructions (for example, the comma separated parameter lists in action calls).
Round-cornered boxes represent sequences of characters that form the terminal symbols of the language. Terminal symbols must be taken literally. They are not defined in terms of any other symbol. Terminal symbols are things such as keywords, separators, punctuation, and operators. For convenience, several characters are usually elided into a single box rather than making them separate boxes. For example:
Action
Square-cornered boxes represent named nonterminal symbols or production rules, each of which is further elaborated by a rule in another diagram. At the point where a nonterminal symbol appears, you insert a construct that follows the rules for that symbol and then continue. All nonterminal symbols are defined in terms of a combination of other nonterminal and terminal symbols in a manner such that if all nonterminal symbols were to be replaced by their definitions, the result is a finite sequence consisting only of terminal symbols.
There are three kinds of combinations of terminal and non-terminal symbols: sequence, repetition, and choice.