Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the grammar from Week 5 to IMPLEMENT the parser in C++. The Week 5 grammar i

ID: 3805241 • Letter: U

Question

Use the grammar from Week 5 to IMPLEMENT the parser in C++. The Week 5 grammar is: ::= + | * | ( ) | ::= a | b | ... | z NOTE: The second production means, an consists of any single lower-case letter. This grammar has the very special property that EVERY LEXEME (and therefore EVERY TOKEN) consists of EXACTLY ONE CHARACTER. Your parser should accept a string of characters input by the user, and tell the user whether it IS or IS NOT an expression according to the Week 5 grammar. You must submit your code, and screen shot(s) of your test runs demonstrating AT A MINIMUM the parser gives the correct answers for the following CORRECT and INCORRECT test cases:

z

(z)

a+b

(a+b)

a+b*z

a+(b*z)

a*(b+(c*d))

Zz

(z

+ab

a+b)

ab*z

a(b*z)

a*(b+d))

Explanation / Answer

Here is the code for above scenario:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote