

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: ORGNZTN PROGM LANG; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


For this exercise, weโll call a backtracking recursive- descent parser a backtracking parser, and a non- backtracking recursive-descent parser a predic- tive parser.
(a) Compute First sets for each produc- tion (b) Can the grammar be parsed by a pre- dictive parser? (c) Implement a predictive parser for the grammar (d) Use your parser to parse the strings โbdโ and โaccโ. Show the sequence of procedure calls in the parse, and what symbols remain to be parsed at each point.
(a) Compute First sets for each produc- tion (b) Can the grammar be parsed by a pre- dictive parser? (c) Can the grammar be parsed by a back- tracking parser? (d) Is the grammar ambiguous? Prove your answer. (e) Are all ambiguous grammars non-parseable by predictive parsers? (f) Are all non-ambiguous grammars parseable by predictive parsers?
(a) Compute First sets for each produc- tion (b) Can the grammar be parsed by a pre- dictive parser? (c) Can the grammar be parsed by a back- tracking parser? (d) Rewrite grammar using the rule for eliminating left recursion (e) Compute First sets for each produc- tion (f) Can the resulting grammar be parsed by a predictive parser? (g) Write a predictive parser for the gram- mar (h) Use your parser to parse the string โ(a,a)โ. Show the sequence of calls in the parse, and what symbols remain to be parsed at each point.
(a) Compute First sets for each produc- tion (b) Is the grammar ambiguous? (c) Can the grammar be parsed by a pre- dictive parser? (d) Can the grammar be parsed by a back- tracking parser? (e) Rewrite grammar using the rule for eliminating left recursion (f) Compute First sets for each produc- tion (g) Can the resulting grammar be parsed by a predictive parser? (h) Write a predictive parser for the gram- mar (i) Use your parser to parse the string โa
(a) Can the grammar be parsed by a pre- dictive parser? (b) Would the grammar accept the same language as the grammar in the pre- vious problem? (c) What is the difference between this grammar and the previous grammar rewritten to eliminate left recursion?
(a) S โ S + a | b (b) S โ S + a | S + b | c (c) S โ S + a | S + b | (d) S โ a b c | a c (e) S โ a b c | a b b (f) S โ a b c | a b (g) S โ a a | a b | a c (h) S โ a a | a b | a (i) S โ a a | a b | (j) S โ a S c | a S b | b (k) S โ a S c | a S b | a (l) S โ a S c | a S | a