Skip to content
juansc edited this page Jan 31, 2015 · 10 revisions
range = Exp '..' Exp ('by' Exp)?
newLine = '\r?\n'

Program = Block
Block = (Stmt + newLine)+

Stmt = 'while' Exp ':' (newLine Block 'end' | Exp newLine)
      | 'for' id 'in' Exp ':' (newLine Block 'end' | Exp newLine)
      | Exp 

Exp = id|TupLit ':' (Type)? '=' Exp
      | id|TupLit '=' Exp
      | ConditionalExp

ConditionalExp = Exp 'if' Exp ('else' Exp)?
               | 'if' Exp ':' newLine Block ('else if' Exp ':' newLine Block)* ('else:' newLine Block 'end')?
               | Exp0
Exp0      =  Exp1 ('or' Exp1)*
Exp1      =  Exp2 ('and' Exp2)*
Exp2      =  Exp3 (relop Exp3)?
Exp3      =  Exp4 (addop Exp4)*
Exp4      =  Exp5 (mulop Exp5)*
Exp5      =  prefixop? Exp6
Exp6      =  boolLit | intLit | id | '(' Exp ')' | StringLit | TupLit | SetLit | MapLit | ListLit 
Exp7 = id('[' Exp ']')?