1Program: 2 (FunDecl)* 3 4FunDecl: 5 "FUN" Ident "=" Expr 6 7Expr: 8 "(" Expr ")" 9| 10 Expr AddOp Expr 11| 12 Expr MultOp Expr 13| 14 Expr CmpOp Expr 15| 16 Ident 17| 18 Number 19| 20 FunAppl 21| 22 UnOp Expr 23| 24 IfExpr 25 26IfExpr: 27 "IF" Expr "THEN" Expr ["ELSE" Expr] "FI" 28 29FunAppl: 30 Ident "(" [Expr ("," Expr)*] ")" 31 32AddOp: 33 ("+" | "-" | "OR") 34 35MultOp: 36 ("*" | "/" | "%" | "AND") 37 38CmpOp: 39 ("==" | "!=" | "<=" | ">=" | ">" | "<"") 40 41UnOp: 42 ("-" | "!") 43 44Ident: 45 LETTER (LETTER|DIGIT)* 46 47Number: 48 DIGIT+ 49 50LETTER: 51 [a-zA-Z] 52 53DIGIT: 54 [0-9] 55 56--------------------------------------------------------- 57Expr: 58 Term [AddOp Term] 59| 60 UnOp Expr 61| 62 FunAppl 63 64Term: 65 Factor [MultOp Factor] 66 67Factor: 68 Element [CmpOp Element] 69 70Element: 71 Ident 72| 73 Number 74| 75 "(" Expr ")" 76