预定/报价
COMPILER
COMPILER
yet2024-09-03 14:32:24

01: CODE → VDECL CODE | FDECL CODE | ?

02: VDECL → vtype id semi | vtype ASSIGN semi

03: ASSIGN → id assign RHS

04: RHS → EXPR | literal | character | boolstr

05: EXPR → EXPR addsub EXPR | EXPR multdiv EXPR

06: EXPR → lparen EXPR rparen | id | num

07: FDECL → vtype id lparen ARG rparen lbrace BLOCK RETURN rbrace

08: ARG → vtype id MOREARGS | ?

09: MOREARGS → comma vtype id MOREARGS | ?

10: BLOCK → STMT BLOCK | ?

11: STMT → VDECL | ASSIGN semi

12: STMT → if lparen COND rparen lbrace BLOCK rbrace ELSE

13: STMT → while lparen COND rparen lbrace BLOCK rbrace

14: COND → COND comp COND | boolstr

15: ELSE → else lbrace BLOCK rbrace | ?

16: RETURN → return RHS semi

? Terminals (21)