70 likes | 213 Vues
This homework assignment focuses on constructing parsing tables for specified grammars. In Chapter 5, part 5.2, you are required to create the LL(1) parse table for the grammar defined by the productions: Expr → -Expr | (Expr) | Var ExprTail, where ExprTail and Var are defined similarly. Subsequently, in Chapter 6, you'll build a CFSM for a provided grammar and demonstrate the LR parse table derived from it. Additionally, complete the SLR(1) construction for a grammar shown in Fig. 6.26, and submit a handwritten version in class by December 6, 2011.
E N D
Homework #4 J. H. Wang Nov. 15, 2011
Homework #4 • Chap. 5 • 5.2 • Chap. 6 • 6.1 • 6.2 • 6.23
Chap. 5 • 5.2: Construct the LL(1) parse table for the following grammar: Expr - Expr | ( Expr ) | Var ExprTail ExprTail - Expr | λ Var id VarTail VarTail ( Expr ) | λ
Chap. 6 • 6.1: Build the CFSM for the following grammar: Prog Block $ Block begin StmtList end StmtList StmtList semi Stmt | Stmt Stmt Block | Var assign Expr Var id | id lb Expr rb Expr Expr plus T | T T Var | lp Expr rp
6.2: Show the LR parse table for the CFSM constructed in 6.1. • 6.23: Complete the SLR(1) construction for the grammar shown in Fig. 6.26. Show the resulting parse table.
Submission • Hand-written exercises: hand in your paper version in class • Due: two weeks (Dec. 6, 2011)