program ::= progtype TK_IDENTIFIER "{" body "}"
progtype ::= "class"
| "entity"
body ::= opt_inherits opt_globals
opt_inherits ::= { inherit }
inherit ::= "inherit" TK_IDENTIFIER ( ";" | TK_IDENTIFIER ";" )
opt_globals ::= { global }
global ::= statevars
| prototypes
| funcspec
statevars ::= opt_mods type ids ";"
opt_mods ::= { mod }
mod ::= "abstract"
| "final"
| "private"
| "protected"
| "public"
| "varargs"
| "volatile"
type ::= basic_type
| class_type
basic_type ::= typename
| basic_type "[" "]"
| basic_type "[" basic_type "]"
| basic_type "[" class_type "]"
typename ::= "any"
| "float"
| "int"
| "string"
| "void"
class_type ::= TK_IDENTIFIER
| indexed_name
| preindexed_name "]"
| preindexed_name basic_type "]"
preindexed_name ::= ( TK_IDENTIFIER | indexed_name ) "["
indexed_name ::= preindexed_name ( TK_IDENTIFIER "]" | indexed_name "]" )
ids ::= { TK_IDENTIFIER "," } TK_IDENTIFIER
prototypes ::= opt_mods type funcs ";"
funcs ::= { func "," } func
func ::= TK_IDENTIFIER "(" opt_parameters ")"
opt_parameters ::= [ parameters ]
parameters ::= { parameter "," } parameter
parameter ::= type opt_id
opt_id ::= [ TK_IDENTIFIER ]
funcspec ::= opt_mods type func block
block ::= "{" opt_localvars opt_statements "}"
opt_localvars ::= { localvar }
localvar ::= type ids ";"
opt_statements ::= [ statements ]
statements ::= { statement } statement
statement ::= ";"
| block
| exprlist ";"
| "if" "(" exprlist ")" statement opt_else
| "do" statement "while" "(" exprlist ")"
| "for" "(" opt_expr ";" opt_expr ";" opt_expr ")" statement
| "while" "(" exprlist ")" statement
| "switch" "(" exprlist ")" block
| "case" label ":"
| "default" ":"
| "break" ";"
| "continue" ";"
| "return" opt_exprlist ";"
exprlist ::= { expr "," } expr
expr ::= choice
| lvalue "=" expr
| lvalue assignop expr
choice ::= bin_expr { "?" exprlist ":" bin_expr }
bin_expr ::= prefix
| bin_expr "||" bin_expr
| bin_expr "&&" bin_expr
| bin_expr "|" bin_expr
| bin_expr "^" bin_expr
| bin_expr "&" bin_expr
| bin_expr cmpop bin_expr
| bin_expr "<<" bin_expr
| bin_expr ">>" bin_expr
| bin_expr "+" bin_expr
| bin_expr "-" bin_expr
| bin_expr "*" bin_expr
| bin_expr "/" bin_expr
| bin_expr "%" bin_expr
prefix ::= incdec
| "(" basic_type ")" prefix
| "(" TK_IDENTIFIER ")" prefix
| "(" indexed_name ")" prefix
| "(" preindexed_name "]" ")" prefix
| "(" preindexed_name basic_type "]" ")" prefix
| "-" prefix
| "~" prefix
| "!" prefix
incdec ::= value
| "++" value
| "--" value
| value "++"
| value "--"
value ::= lvalue
| index
lvalue ::= TK_IDENTIFIER
| indexed_name
| preindexed_name exprlist "]"
| preindexed_name opt_expr ".." opt_expr "]"
index ::= primary
| index "[" exprlist "]"
| index "[" opt_expr ".." opt_expr "]"
primary ::= constant
| "(" TK_IDENTIFIER ")"
| "(" indexed_name ")"
| "(" exprlist ")"
| "(" "{" opt_exprlist "}" ")"
| "(" "[" opt_hashlist "]" ")"
| funcref "(" opt_arguments ")"
constant ::= TK_FLT_CONST
| TK_INT_CONST
| TK_STR_CONST
opt_exprlist ::= [ exprlist ]
opt_hashlist ::= [ hashlist ]
hashlist ::= { hashelt "," } hashelt
hashelt ::= expr ":" expr
funcref ::= [ "::" | TK_IDENTIFIER "::" | value "->" ] TK_IDENTIFIER
opt_arguments ::= [ exprlist [ "..." ] ]
opt_else ::= [ "else" statement ]
opt_expr ::= [ expr ]
label ::= expr
| opt_expr ".." opt_expr
assignop ::= "+="
| "-="
| "*="
| "/="
| "%="
| "<<="
| ">>="
| "&="
| "^="
| "|="
cmpop ::= "=="
| "!="
| ">"
| ">="
| "<="
| "<"
Copyright © 1994-2001 Kris Van Hees. All rights reserved.