program

statementstatement

statement

if_stmtif_stmt function_deffunction_def assignment_stmtassignment_stmt dict_set_stmtdict_set_stmt TERMTERM

if_stmt

IFIF conditional_exprconditional_expr COLONCOLON end of lineend of line blockblock end of lineend of line ELIFELIF conditional_exprconditional_expr COLONCOLON end of lineend of line blockblock end of lineend of line ELSEELSE COLONCOLON end of lineend of line blockblock

IF

'if'

comparison_op operations

exprexpr nested_expr_expressionnested_expr_expression comparison_opcomparison_op exprexpr nested_expr_expressionnested_expr_expression exprexpr nested_expr_expressionnested_expr_expression

expr

string_exprstring_expr bool_exprbool_expr arith_exprarith_expr

string_expr

'^' operations'^' operations

'^' operations

stringstring nested_string_expressionnested_string_expression CONCATCONCAT stringstring nested_string_expressionnested_string_expression stringstring nested_string_expressionnested_string_expression

nested_string_expression

'(' [suppress] string_exprstring_expr ')' [suppress]

CONCAT

'^'

string

"([^\\"]|\\[\\nrt])*"

bool_expr

'or' operations'or' operations

'or' operations

'and' operations'and' operations OROR 'and' operations'and' operations 'and' operations'and' operations

'and' operations

'not' operations'not' operations ANDAND 'not' operations'not' operations 'not' operations'not' operations

'not' operations

NOTNOT 'not' operations'not' operations TRUETRUE FALSEFALSE conditional_exprconditional_expr nested_bool_operand_expressionnested_bool_operand_expression

NOT

'not'

TRUE

'true'

FALSE

'false'

conditional_expr

comparison_op operationscomparison_op operations

nested_bool_operand_expression

'(' [suppress] bool_exprbool_expr ')' [suppress]

AND

'and'

OR

'or'

arith_expr

add_op operationsadd_op operations

add_op operations

mul_op operationsmul_op operations add_opadd_op mul_op operationsmul_op operations mul_op operationsmul_op operations

mul_op operations

unary_minus operationsunary_minus operations mul_opmul_op unary_minus operationsunary_minus operations unary_minus operationsunary_minus operations

unary_minus operations

unary_minusunary_minus unary_minus operationsunary_minus operations floatfloat integerinteger nested_arith_operand_expressionnested_arith_operand_expression

unary_minus

'-'

float

(0|[1-9]\d*)\.\d*

integer

0|[1-9][0-9]*

nested_arith_operand_expression

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

mul_op

MULMUL DIVDIV MODMOD

MUL

'*'

DIV

'/'

MOD

'%'

add_op

ADDADD SUBSUB

ADD

'+'

SUB

'-'

nested_expr_expression

'(' [suppress] conditional_exprconditional_expr ')' [suppress]

comparison_op

LELE GEGE LTLT GTGT EQEQ NENE

LE

'<='

GE

'>='

LT

'<'

GT

'>'

EQ

'=='

NE

'!='

block

statementstatement end of lineend of line

ELIF

'elif'

ELSE

'else'

function_def

DEFDEF identifieridentifier LPARLPAR identifieridentifier ',' [suppress] identifieridentifier RPARRPAR COLONCOLON end of lineend of line blockblock ENDEND

DEF

'def'

identifier

[a-z][a-zA-Z0-9_]*

LPAR

'(' [suppress]

RPAR

')' [suppress]

COLON

':' [suppress]

END

'end'

assignment_stmt

identifieridentifier '=' exprexpr

dict_set_stmt

identifieridentifier LSQUARELSQUARE exprexpr RSQUARERSQUARE DICT_SETDICT_SET exprexpr

LSQUARE

'[' [suppress]

RSQUARE

']' [suppress]

DICT_SET

'<-'

TERM

end of lineend of line end of textend of text

end of line

LineEnd

end of text

StringEnd