CSC 4101 Chapter : Homework2

13 views4 pages
15 Mar 2019
School
Course
Professor

Document Summary

Consider the following grammar for variable and class declarations in java: -> class id lbrace rbrace. 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. Show a derivation for the string a b a a". S => a m and in each step replace one nonterminal by the right-hand side of a grammar rule until you end up with the symbols a b a a" on a line by itself. Underline the nonterminal you are expanding and write the expanded line underneath: (10 pts) Write grammar productions for the java exception handling constructs try-catch-finally and throw. The keywords are try, catch, finally, and throw. Both the try-catch-finally construct and the throw construct are statements.

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

Related Documents