Question: Question: In this homework, you will develop LL recursive descent parser utilizing the lexical analyzer developed in homework 1 . Your developed parser should be

Question: In this homework, you will develop LL recursive descent parser utilizing the lexical analyzer developed in homework 1. Your developed parser should be able to identify whether an input arithmetic expression can be derived by the following grammar or not.
The input to your parser would be different sentences containing terms, factors, etc. These input sentences may or may not be derivable utilizing the grammar. For example, (total *21)*125 is derivable and ((total *21)*125 is not derivable. You have to verify whether each of these inputs is derivable by the grammar or not.
Update your lexical analyzer in the following way:
Develop a function called lex(), which will return the next token and next lexeme values from an input sentence or update the global variables associated with the next token and next lexeme.
If an input has four tokens, calling the lex() function for the first time will update the 1st(lexeme, token) pair, the 2nd time will update the 2nd(lexeme, token) pair, and so on.
How to integrate lexical analyzer with your parser:
Feed the input sentence to the lexical analyzer.
From your parser, call lex() function each time you need a token to analyze.
You need to print enough statements to have an idea of how the grammar derives the input sentence. For example, the derivation tree for (sum +47
 Question: In this homework, you will develop LL recursive descent parser

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!