This file describes the grammar lab4 is expected to recognize. Notes on what's missing in the provided lab4.yacc ------------------------------------------------- It assumes 'program' is the top level abstract component. The starter version of lab4.yacc does not yet include the missing lab4.lex token types (STRLIT, FUNDEF, LTOP, ANDOP, OROP, NOTOP, READCTRL), so in the starter version of lab4.yacc they are also missing from the token lists and the implementations of the various grammar rules shown below. Four key nonterminals have yet to be implemented, readstmt, fundefn, formalparams, identlist. Thus in the starter version of lab4.yacc they also are missing from the nonterminal lists and the implementations of the various grammar rules shown below. Final desired grammar rules --------------------------- program --> statements statements --> statement | statement statements statement --> definition | expr | control exprlist --> expr | expr exprlist expr --> literal | funcall | IDENT control --> ifstmt | prtstmt | readstmt identlist --> IDENT | IDENT identlist literal --> STRLIT | INTLIT | REALLIT definition --> vardefn | fundefn | arrdefn funcall --> funtype actparams funtype --> IDENT | builtin builtin --> ADDOP | MULOP | SUBOP | DIVOP | SETOP | EQOP | LTOP | OROP | ANDOP | NOTOP ifstmt --> IFCTRL OPENBR expr statement statement CLOSEBR prtstmt --> PRTCTRL OPENBR exprlist CLOSEBR readstmt --> READCTRL OPENBR identlist CLOSEBR vardefn --> VARDEF OPENBR IDENT typename expr CLOSEBR arrdefn --> ARRDEF OPENBR IDENT typename exprlist CLOSEBR fundefn --> FUNDEF OPENBR IDENT typename formalparams statements CLOSEBR typename --> REALTYPE | INTTYPE | STRTYPE actparams --> OPENBR exprlist CLOSEBR | openclose formalparams --> OPENBR identlist CLOSEBR | openclose openclose --> OPENBR CLOSEBR