Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the Recursive Descent Parser (RDP) for the Grammar --> {(+ | -) } --> {(* | /) } --> id | int_constant | (

Implement the Recursive Descent Parser (RDP) for the Grammar

--> {(+ | -) }

--> {(* | /) }

--> id | int_constant | ( )

Specification:

1- Use the procedures in the slides to implement the RDP

2- Create a class called Lexer that takes an input expression as a string and outputs its token

stream

3- Make sure that your Lexer catches any unidentified characters that do not belong to the

grammar

4- The RDP should then proceed to parse the input expression

5- Your code should be in C# and should compile on Visual Studio 2017

6- ...

7- If you are creating a Console application, your code should compile on https://dotnetfiddle.net/

8- Attach a ReadME.txt file to your implementation to describe exactly how to compile your code

9- Submit your code and executables via Moodle in a zip file format

10- Failure to submit by the deadline will result in a zero grade11- If your code does not compile, you will lose 40% of the grade, and you will be given 3 more days

to submit a working version. Failure to submit a working code or the second time will result in a

zero grade

12- Follow the general styling guidelines for your code (comments and meaningful variable names)

13- Point distribution: 50 points for Lexer, 40 points for RDP, and 10 points for styling.

14- Your main output window should look something like this:

Enter your expression: num1 + num2 / (3 + total) ----------------------------------- Calling Lexer: num1: IDENT +: ADD_OP num2: IDENT /: DIV_OP (: LEFT_PAREN 3: INT_LIT +: ADD_OP total: IDENT ): RIGHT_PAREN

---------------------------------- Calling the Recursive Descent Parser: NextToken: IDENT Enter Enter Enter NextToken: ADD_OP Exit Exit NextToken: IDENT Enter Enter NextToken: DIV_OP Exit NextToken: LEFT_PAREN Enter NextToken: INT_LIT Enter Enter Enter NextToken: ADD_OP Exit Exit NextToken: IDENT Enter Enter NextToken: RIGHT_PAREN Exit Exit Exit NextToken: EOF Exit Exit Exit Press any key to continue . . .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago