Question: Use bison (yacc) to generate a parser (syntax checker) for a subset of the BNF representation of Java (listed in Appendix IV of the text
Use bison (yacc) to generate a parser (syntax checker) for a subset of the BNF representation of Java (listed in Appendix IV of the text book: Languages and Machines: An Introduction to the Theory of Computer Science by Thomas A. Sudkamp). Your subset should include specifications of: while, do and for statements, if and if else statements. For the expressions, use arithmetic expressions and operators.
Write example Java code (4 conforming examples[inputs]) to show the capabilities of your parser for checking the constructs you implemented. Add (2) examples where an error is detected. Total (6) examples with Java code as inputs, running through the parser, and output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
