Reference no: EM132217600
C++ Code
Implement a recursive descent parser for a logic calculator based on the Grammar below.
The user can use either capital or lower case 'T' and 'F' in their expression.
Use either a ';' or '=' to indicate the expression should be evaluated immediately.
The program should not exit when it encounters an error in the expression. Rather, it should output error information and then accept the next expression.
Use either a capital or lowercase 'Q' to indicate you want to exit the program.
Grammar
Note: This grammar uses the '|' symbol as a terminal. In place of that symbol, we will use '∨' to separate replacement options for each grammar rule.
Expression âžTM Term ∨ Expression | Term
Term âžTM Factor ∨ Term & Factor
Factor âžTM Primary ∨ Factor ^ Primary
Primary âžTM T ∨ F ∨ ( Expression ) ∨ ! Expression