4. TYPE integer | real |
string
error: Data type expected
5. CMPD_STMT begin
6. OPT_STMTS
OPT_STMTS end |
STMT_LIST
7. STMT_LIST STMT STMT_LIST_END
8. STMT_LIST_END 9.STMT id:=EXPR
; STMT_LIST |
CMPD_STMT
if COND then STMT else STMT while COND do STMT
error: Beginning of statement expected
10. COND EXPR RELOP EXPR 11. EXPR VAL EXPR_END
| | |
Mini PASCAL Grammar
Key
ALL_CAPS
Non-Terminals
lower case and symbols
Terminals (Tokens)
|
grammar metasymbol OR Ab|c == Ab Ac
{ term, term, .. }
Select1 Set
0. PROGRAM program id ; DECLARATIONS CMPD_STMT . period
1. ID_LIST id ID_LIST_END
2. ID_LIST_END , ID_LIST |
3. DECLARATIONS var ID_LIST : TYPE ; DECLARATIONS |
{,}
{ default }
{ var } {default}
{ integer } { real }
{ string }
{ end }
{ default }
{;}
{ default }
{ id }
{ begin } { if }
{ while }
12. EXPR_END ARITH_OP VAL EXPR_END |
you can figure out select sets for the rest
13.ARITH_OP+ | | * | / error: arithmetic operator expected
14. RELOP< | <= | > | >= | <> | = error: relational operator expected
15. VAL id| int_lit | real_lit | char_lit | ( EXPR ) |
SIGN VAL
error: value expected
16. SIGN+| error: sign expected
{ + * / } { default }
Reviews
There are no reviews yet.