program | ::= | { definition } |
definition | ::= | import | inheritance | function_declaration | function_definition | variables | constant | class_def |
import | ::= | modifiers import ( constant_identifier | string ) ";" |
inheritance | ::= | modifiers inherit program_specifier [ ":" identifier ] ";" |
function_declaration | ::= | modifiers type identifier "(" arguments ")" ";" |
function_definition | ::= | modifiers type identifier "(" arguments ")" block |
variables | ::= | modifiers type variable_names ";" |
variable_names | ::= | variable_name { "," variable_name } |
variable_name | ::= | { "*" } identifier [ "=" expression2 ] |
constant | ::= | modifiers constant constant_names ";" |
constant_names | ::= | constant_name { "," constant_name } |
constant_name | ::= | identifier "=" expression2 |
class_def | ::= | modifiers class [ ";" ] |
class | ::= | class [ identifier ] "{" program "}" |
modifiers | ::= | { static | private | nomask | public | protected | inline } |
block | ::= | "{" { statement } "}" |
statement | ::= | expression2 ";" | cond | while | do_while | for | switch | case | default | return | block | foreach | break | continue | ";" |
cond | ::= | if statement [ else statement ] |
while | ::= | while "(" expression ")" statement |
do_while | ::= | do statement while "(" expression ")" ";" |
for | ::= | for "(" [ expression ] ";" [ expression ] ";" [ expression ] ")" statement |
switch | ::= | switch "(" expression ")" block |
case | ::= | case expression [ ".." expression ] ":" |
default | ::= | default ":" |
foreach | ::= | foreach "(" expression ":" expression6 ")" statement |
break | ::= | break ";" |
continue | ::= | continue ";" |
expression | ::= | expression2 { "," expression2 } |
expression2 | ::= | { lvalue ( "=" | "+=" | "*=" | "/=" | "&=" | "|=" | "^=" | "<<=" | ">>=" | "%=" ) } expression3 |
expression3 | ::= | expression4 '?' expression3 ":" expression3 |
expression4 | ::= | { expression5 ( "||" | "&&" | "|" | "^" | "&" | "==" | "!=" | ">" | "<" | ">=" | "<=" | "<<" | ">>" | "+" | "*" | "/" | "%" ) } expression5 |
expression5 | ::= | expression6 | "(" type ")" expression5 | "--" expression6 | "++" expression6 | expression6 "--" | expression6 "++" | "~" expression5 | "-" expression5 |
expression6 | ::= | string | number | float | catch | gauge | typeof | sscanf | lambda | class | constant_identifier | call | index | mapping | multiset | array | parenthesis | arrow |
number | ::= | digit { digit } | "0x" { digits } | "'" character "'" |
float | ::= | digit { digit } "." { digit } |
catch | ::= | catch ( "(" expression ")" | block ) |
gauge | ::= | gauge ( "(" expression ")" | block ) |
sscanf | ::= | sscanf "(" expression2 "," expression2 { "," lvalue } ")" |
lvalue | ::= | expression6 | type identifier | "[" [ lvalue { "," lvalue } [ "," ] ] "]" |
lambda | ::= | lambda "(" arguments ")" block |
constant_identifier | ::= | ["."] identifier { "." identifier } |
call | ::= | expression6 "(" expression_list ")" |
index | ::= | expression6 "[" expression [ ".." expression ] "]" |
array | ::= | "({" expression_list "})" |
multiset | ::= | "(<" expression_list ">)" |
mapping | ::= | "([" [ expression : expression { "," expression ":" expression } ] [ "," ] "])" |
arrow | ::= | expression6 "->" identifier |
parenthesis | ::= | "(" expression ")" |
expression_list | ::= | [ splice_expression { "," splice_expression } ] [ "," ] |
splice_expression | ::= | [ "@" ] expression2 |
type | ::= | ( int | string | float | program | object [ "(" program_specifier ")" ] | mapping [ "(" type ":" type ")" | array [ "(" type ")" ] | multiset [ "(" type ")" ] | function [ function_type ] ) { "*" } |
function_type | ::= | "(" [ type { "," type } [ "..." ] ")" |
arguments | ::= | [ argument { "," argument } ] [","] |
argument | ::= | type [ "..." ] [ identifier ] |
program_specifier | ::= | string_constant | constant_identifier |
string | ::= | string_literal { string_literal } |
identifier | ::= | letter { letter | digit } | "`+" | "`/" | "`%" | "`*" | "`&" | "`|" | "`^" | "`~" | "`<" | "`<<" | "`<=" | "`>" | "`>>" | "`>=" | "`==" | "`!=" | "`!" | "`()" | "`-" | "`->" | "`->=" | "`[]" | "`[]=" |
letter | ::= | "a"-"z" | "A"-"Z" | "_" |
digit | ::= | "0"-"9" |