Question: Write a Java program (using JFlex/Cup) to interpret WAE expressions. The CFG for WAE expressions is given below: ::= SEMI ::= | (+ > |

 Write a Java program (using JFlex/Cup) to interpret WAE expressions. The

Write a Java program (using JFlex/Cup) to interpret WAE expressions. The CFG for WAE expressions is given below: ::= SEMI ::= | (+ > | (- > | (with { } > | You will write a main program, called WAE.java, that prompts the user with wae> . The user can enter a WAE expression at the prompt or type exit to exit the WAE interpreter. If the user enters a WAE expression, your program should verify that it is a valid expression. If the expression is valid, it should be evaluated and the value of the expression should be printed: Otherwise and error message should be reported. Sample Run: $ java WAE WAE> {with {x 3} {with {y 4} {with {z 5} {+ x {+ y z} } } } } The value is 12 WAE> (with {x 3} {with {y 4} {+ y z} } Syntax Error WAE> {with {x 3} {with {y 4} {+ y z} } } Semantic Error

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!