-
Notifications
You must be signed in to change notification settings - Fork 1
Grammer
Jonathan Beaulieu edited this page Jan 31, 2018
·
1 revision
Below is Little Python's Grammar as you may notice it can depend on which features are enabled.
Also unfortunately it isn't completely described here. However if you are interested it is implemented in code in parser.py
program : (newline) statement
| program statement
statement : assign_statement
| expression
| control
| empty
Feature For Loop adds:
| loop
Feature Func adds:
| func
| return statement
assign_smt : variable ASSIGN expression(;)
Feature Type Array adds:
| variable SETITEM expression(;)
return_smt : expression
control : 'if' expression block ('elif' expression block)* ('else' block)
loop : 'for' init; ctrl; inc block
init : assign_statement
|
ctrl : expression
|
inc : assign_statement
|
func : 'func' name(paramlist) block
paramlist : var, paramlist
paramlist : var
paramlist :
arglist : expression, arglist
arglist : expression
arglist :
block : { (newline) statements } (newline)
variable : var
Feature Type Array adds:
variable : variable[expression]
Feature Type Func adds:
variable : variable(arg_list)