Question: Write a Java program (using JFIex/Cup) to interpret WAE expressions. The CFG for WAE expressions is given below: SEMI ::= I {+ ) I (-

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

Write a Java program (using JFIex/Cup) to interpret WAE expressions. The CFG for WAE expressions is given below: SEMI ::= I {+ ) I (- } I {with { ) > I 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. $ 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 2}}} 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!