Question: As you can see, Language Four extends Language Three with three new constructs: the < operator for comparison, the - operator for subtraction, and the
As you can see, Language Four extends Language Three with three new constructs: the operator for comparison, the operator for subtraction, and the conditional ifthenelse expression. The sample program above defines a recursive factorial function and uses it to compute the factorial of
a Define the syntax of Language Four by extending the syntax of Language Three with the three additional constructs required. Show your new BNF Make sure it is unambiguous.
b Define the three new kinds of AST nodes you need to match your extended syntax. Extend the Prolog implementation of Language Three to handle them. You will need to start with the dynamicscoping implementation, since the staticscoping one cannot handle recursive definitions. For this reason, the sample program above is not legal in ML Verify that your implementation evaluates the sample program correctlythe factorial of is
c Give a natural semantics for Language Four.
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
