CSc 4340/6340 Compilers
Spring 2012
Homework 3
Due: March 30, 2012 (Friday)
Produce a top-down predictive parsing table for the following grammar
and determine if the grammar is LL(1) or not.
(1) ddb ::= idb_rules DOLLAR
(2) idb_rules ::= idb_rule
(3) idb_rules ::= idb_rule idb_rules
(4) idb_rule ::= NAME LPAREN arg_list RPAREN IMPLIES idb_body PERIOD
(5) idb_body ::= literal
(6) idb_body ::= literal COMMA idb_body
(7) literal ::= NOTOP predicate
(8) literal ::= predicate
(9) predicate ::= NAME LPAREN arg_list RPAREN
(10) predicate ::= arg COMPARISON arg
(11) arg_list ::= arg
(12) arg_list ::= arg COMMA arg_list
(13) arg ::= NUMBER
(14) arg ::= STRING
(15) arg ::= VARIABLE
Please place the rule number in the parsing table.