program

decldecl

decl

variable_declvariable_decl function_declfunction_decl class_declclass_decl interface_declinterface_decl prototypeprototype

variable_decl

type_type_ any_keywordany_keyword [NOT] identifieridentifier SEMISEMI

type_

INTINT DOUBLEDOUBLE BOOLBOOL STRINGSTRING identident '[]'

ident

any_keywordany_keyword [NOT] identifieridentifier

function_decl

INTINT DOUBLEDOUBLE BOOLBOOL STRINGSTRING identident '[]' 'void' any_keywordany_keyword [NOT] identifieridentifier LPARLPAR type_type_ any_keywordany_keyword [NOT] identifieridentifier ',' [suppress] type_type_ any_keywordany_keyword [NOT] identifieridentifier RPARRPAR LBRACELBRACE variable_declvariable_decl stmtstmt RBRACERBRACE

stmt

if_stmtif_stmt while_stmtwhile_stmt for_stmtfor_stmt break_stmtbreak_stmt return_stmtreturn_stmt print_stmtprint_stmt stmt_blockstmt_block exprexpr SEMISEMI

if_stmt

'if' LPARLPAR exprexpr RPARRPAR stmtstmt ELSEELSE stmtstmt

expr

assignmentassignment callcall THISTHIS arith_expr_expressionarith_expr_expression arith_exprarith_expr lvaluelvalue real numberreal number TRUETRUE FALSEFALSE hex_constanthex_constant integerinteger string enclosed in double quotesstring enclosed in double quotes NULLNULL read_integerread_integer read_lineread_line new_statementnew_statement new_arraynew_array

assignment

any_keywordany_keyword [NOT] identifieridentifier LPARLPAR exprexpr RPARRPAR DOTDOT identident expr_parensexpr_parens LBRACKLBRACK exprexpr RBRACKRBRACK EQEQ exprexpr

expr_parens

LPARLPAR exprexpr RPARRPAR

EQ

'=' [suppress]

call

any_keywordany_keyword [NOT] identifieridentifier LPARLPAR exprexpr ',' [suppress] exprexpr RPARRPAR LPARLPAR exprexpr RPARRPAR DOTDOT any_keywordany_keyword [NOT] identifieridentifier LPARLPAR exprexpr ',' [suppress] exprexpr RPARRPAR

arith_expr_expression

|| operations|| operations

|| operations

&& operations&& operations |||| && operations&& operations && operations&& operations

&& operations

== | != operations== | != operations &&&& == | != operations== | != operations == | != operations== | != operations

== | != operations

<= | < | >= | > operations<= | < | >= | > operations == | !=== | != <= | < | >= | > operations<= | < | >= | > operations <= | < | >= | > operations<= | < | >= | > operations

<= | < | >= | > operations

'!' operations'!' operations <= | < | >= | ><= | < | >= | > '!' operations'!' operations '!' operations'!' operations

'!' operations

'!' '!' operations'!' operations arith_exprarith_expr nested_arith_exprnested_arith_expr

arith_expr

+ | - operations+ | - operations

+ | - operations

* | / | % operations* | / | % operations + | -+ | - * | / | % operations* | / | % operations * | / | % operations* | / | % operations

* | / | % operations

'-' operations'-' operations * | / | %* | / | % '-' operations'-' operations '-' operations'-' operations

'-' operations

'-' '-' operations'-' operations real numberreal number TRUETRUE FALSEFALSE hex_constanthex_constant integerinteger string enclosed in double quotesstring enclosed in double quotes NULLNULL callcall read_integerread_integer read_lineread_line new_statementnew_statement new_arraynew_array identident nested_rvaluenested_rvalue

string enclosed in double quotes

"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))* '"' [combine]

read_integer

READINTEGERREADINTEGER LPARLPAR RPARRPAR

read_line

READLINEREADLINE LPARLPAR RPARRPAR

new_statement

NEWNEW any_keywordany_keyword [NOT] identifieridentifier

new_array

NEWARRAYNEWARRAY LPARLPAR exprexpr COMMACOMMA type_type_ RPARRPAR

COMMA

',' [suppress]

nested_rvalue

'(' [suppress] arith_exprarith_expr ')' [suppress]

* | / | %

[*/%]

+ | -

[+\-]

nested_arith_expr

'(' [suppress] arith_expr_expressionarith_expr_expression ')' [suppress]

<= | < | >= | >

<=|<|>=|>

== | !=

==|!=

&&

\&\&

||

\|\|

lvalue

identident expr_parensexpr_parens DOTDOT identident expr_parensexpr_parens LBRACKLBRACK exprexpr RBRACKRBRACK

DOT

'.' [suppress]

LBRACK

'[' [suppress]

RBRACK

']' [suppress]

real number

[+-]?(?:\d+\.\d*|\.\d+)

hex_constant

0[xX][0-9a-fA-F]+

integer

W:(0-9)

while_stmt

'while' LPARLPAR exprexpr RPARRPAR stmtstmt

for_stmt

'or' LPARLPAR exprexpr SEMISEMI exprexpr SEMISEMI exprexpr RPARRPAR stmtstmt

break_stmt

'break' SEMISEMI

return_stmt

'return' exprexpr SEMISEMI

print_stmt

'Print' LPARLPAR exprexpr ',' [suppress] exprexpr RPARRPAR SEMISEMI

stmt_block

LBRACELBRACE variable_declvariable_decl stmtstmt RBRACERBRACE

class_decl

CLASSCLASS any_keywordany_keyword [NOT] identifieridentifier EXTENDSEXTENDS any_keywordany_keyword [NOT] identifieridentifier IMPLEMENTSIMPLEMENTS any_keywordany_keyword [NOT] identifieridentifier ',' [suppress] any_keywordany_keyword [NOT] identifieridentifier LBRACELBRACE fieldfield RBRACERBRACE

field

variable_declvariable_decl function_declfunction_decl

interface_decl

INTERFACEINTERFACE any_keywordany_keyword [NOT] identifieridentifier LBRACELBRACE prototypeprototype RBRACERBRACE

LBRACE

'{' [suppress]

prototype

INTINT DOUBLEDOUBLE BOOLBOOL STRINGSTRING identident '[]' 'void' any_keywordany_keyword [NOT] identifieridentifier LPARLPAR type_type_ any_keywordany_keyword [NOT] identifieridentifier ',' [suppress] type_type_ any_keywordany_keyword [NOT] identifieridentifier RPARRPAR SEMISEMI

LPAR

'(' [suppress]

any_keyword

VOIDVOID INTINT DOUBLEDOUBLE BOOLBOOL STRINGSTRING CLASSCLASS INTERFACEINTERFACE NULLNULL THISTHIS EXTENDSEXTENDS IMPLEMENTSIMPLEMENTS FORFOR WHILEWHILE IFIF ELSEELSE RETURNRETURN BREAKBREAK NEWNEW NEWARRAYNEWARRAY PRINTPRINT READINTEGERREADINTEGER READLINEREADLINE TRUETRUE FALSEFALSE

VOID

'void'

INT

'int'

DOUBLE

'double'

BOOL

'bool'

STRING

'string'

CLASS

'class'

INTERFACE

'interface'

NULL

'null'

THIS

'this'

EXTENDS

'extends'

IMPLEMENTS

'implements'

FOR

'or'

WHILE

'while'

IF

'if'

ELSE

'else'

RETURN

'return'

BREAK

'break'

NEW

'new'

NEWARRAY

'NewArray'

PRINT

'Print'

READINTEGER

'ReadInteger'

READLINE

'ReadLine'

TRUE

'true'

FALSE

'false'

identifier

W:(A-Z_a-zªµºÀ-Ö..., 0-9A-Z_a-zªµ·...)

RPAR

')' [suppress]

SEMI

';' [suppress]

RBRACE

'}' [suppress]