Question: 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
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
id-list ! id-list , id
id-list ! id
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
