Table of Contents
BNF for Markup Interpreter: Terminals and Nonterminals
BNF for Markup Interpreter: Terminals and Nonterminals
This appendix lists terminals and nonterminals used by the markup interpreter. Backaus Naur Form (BNF) is a formal compiler-syntax notation system. A terminals is a symbol that is to be written exactly as represented (for example, a token). A nonterminals is a sequence of alternatives consisting of terminals or nonterminals separated by a metasymbol such as "|".
Terminals
<IDENTIFIER> ::= <LETTER> (<LETTER>|<DIGIT>|<SYMBOL>)*
<LETTER> ::= ["a"-"z", "A"-"Z"]
<STR_CHAR> ::= (~["\"","\\","\n","\r"])
( ["n","t","b","r","f","\\","'","\""]
| ["0"-"7"] ( ["0"-"7"] )?
| ["0"-"3"] ["0"-"7"] ["0"-"7"]
<BOOL_VALUE> ::= "TRUE"|"FALSE"|"true"|"false"
Nonterminals
CompilationUnit ::= ( Statement )* <EOF>
Expression ::= Assignment
| ConditionalMatchExpression
Assignment ::= PrimaryExpression "=" Expression
ConditionalMatchExpression ::= ConditionalOrExpression ( "~~" ConditionalOrExpression )*
ConditionalOrExpression ::= ConditionalAndExpression ( "||" ConditionalAndExpression )*
ConditionalAndExpression ::= EqualityExpression ( "&&" EqualityExpression )*
EqualityExpression ::= RelationalExpression ( "==" RelationalExpression |
"!=" RelationalExpression )*
RelationalExpression ::= MatchingExpression ( "<" MatchingExpression |
"<=" MatchingExpression |
">=" MatchingExpression )*
MatchingExpression ::= AdditiveExpression ( "~" StringLiteral )?
AdditiveExpression ::= MultiplicativeExpression ( "+" MultiplicativeExpression |
"-" MultiplicativeExpression )*
MultiplicativeExpression ::= PrimaryExpression ( "*" PrimaryExpression |
PrimaryExpression ::= Literal
Variable ::= <IDENTIFIER>
Literal ::= ( <NUMBER_LITERAL> )
StringLiteral ::= ( <STRING_LITERAL> )
Block ::= "{" ( Statement )* "}"
StatementExpression ::= Assignment ";"
IfStatement ::= "if" "(" Expression ")" Statement ( "else" Statement )?
Posted: Fri Mar 28 17:00:31 PST 2003
All contents are Copyright © 1992--2002 Cisco Systems, Inc. All rights reserved. Important Notices and Privacy Statement .