CSC 4101 Chapter : Homework2

27 views3 pages
15 Mar 2019
School
Course
Professor

Document Summary

Consider the following grammar for pascal variable declarations: var-decl var decl-list decl-list decl ; decl-list decl-list decl decl id-list id-list. Indicate any problems in this grammar that prevent it from being parsed by a recursive-descent parser with one token lookahead. Transform this grammar into a form that can be parsed with a recursive-descent parser with one token lookahead. Make as few changes to the grammar as possible. Do not use extended bnf: (10 pts) Show both a leftmost derivation and a rightmost derivation of the string a a + a *". S => s s + where in each step you replace one nonterminal by the right-hand side of a grammar rule until you end up with the symbols a a + a *" on a line by itself. Underline the nonterminal you are expanding and write the expanded line underneath. Part of the concrete syntax given in the 1960 report on algol 60 is as follows:

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers