Question: Consider the following grammar for applied Lambda expressions: :: = | + | - | * | /
Consider the following grammar for applied Lambda expressions:
:: constants
variable
application
L abstraction
Implement the following:
Write a JJTree specification Progjjt to generate the AST for any applied Lambda expression.
Implement the method String astToString to convert the AST of a Lambda expression into its concrete syntax form.
Implement the method Set FV to find the set of free variables of a Lambda expression AST.
Implement the method void dumpFV to dump a Lambda expression AST with free variables.
Implement the method SimpleNode substituteString var, SimpleNode expr for substituting all the free occurrences of the variable var with a copy of the Lambda expression AST expr in this Lambda expresson AST.
Implement the method SimpleNode normalOrderEvaluate for performing a normal order evaluation of this Lambda expression.
Create a tar file named Progtar from your program files for this assignment and submit it by the due date through Canvas.
Here is a sample execution for the main part:
hs@zeus Prog$ java Prog
Lambda Expression Evaluator
Enter an applied Lambda expression:
L f x f f xL n n
The abstract syntax tree:
appl
appl
lamb
f
lamb
x
appl
f
appl
f
x
lamb
n
appl
appl
mul
appl
appl
sub
n
The Lambda expression in the concrete syntax:
L f L xf f xL n n
The abstract syntax tree with free variables:
appl
appl
lamb
f f
lamb f
xx
appl f x
f f
appl f x
f f
xx
lamb
n n
appl n
appl
mul
appl n
appl n
sub
n n
Enter an applied Lambda expression:
L x f f x
The abstract syntax tree:
lamb
x
appl
f
appl
f
x
Enter the variable to be substituted:
f
Enter the substituting applied Lambda expression:
L n n
The abstract syntax tree:
lamb
n
appl
appl
mul
appl
appl
sub
n
The substitution result:
lamb
x
appl
lamb
n
appl
appl
mul
appl
appl
sub
n
appl
lamb
n
appl
appl
mul
appl
appl
sub
n
x
Enter an applied Lambda expression:
L f x f f xL n n
The normal order evaluation result:
give next code and files of classes i need to create and changes to be made to those files im doing project in eclipse soo kindly give accordingly and ive removed simplenode.java methods in progjjt file as i got errors soo give me code for rest of evaluation methods and progjava maincode also im attaching screenshots of warnings and the files generated by jjt thank you i have already done until jjtree but next part im getting error at parsing soo can u give code for rest of the project Java Compiler Compiler Version Parser Generator
type "javacc" with no arguments for help
Reading from file Prog
Warning: Choice conflict involving two expansions at
line column and line column respectively.
A common prefix is:
Consider using a lookahead of or more for earlier expansion.
Warning: Choice conflict involving two expansions at
line column and line column respectively.
A common prefix is:
Consider using a lookahead of for earlier expansion.
File "TokenMgrError.java" does not exist. Will create one.
File "ParseException.java" does not exist. Will create one.
File "Token.java" does not exist. Will create one.
File "SimpleCharStream.java" does not exist. Will create one.
Parser generated with errors and warnings. Prog
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
