Question: Printer File Grammar File AST file Value file Evaluator File Other Files in the project Reader Interpreter 5. (26 pt) (ArithLang interpreter advanced] Implement an

![Files in the project Reader Interpreter 5. (26 pt) (ArithLang interpreter advanced]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66effa3ab3096_19466effa3a63341.jpg)
Printer File

Grammar File


AST file


Value file

Evaluator File

Other Files in the project
Reader

Interpreter

5. (26 pt) (ArithLang interpreter advanced] Implement an interpreter for Abstract Lang described as follows. You can modify the ArithLang code provided. (a) This language contains only six terminals, p, n, u, +, - (b) p represents positve numbers, n represents negative numbers and u represent unknown values (c) There are two operators + and - that can be applied on the terminals, their syntactic rules are similar to + and - in ArithLang, except that each operator only can take two operands () The semantics of AbstractLang are defined by the following rules (the first column in the table represents the first operand and the first row in the table represents the second operand of the operation): + p nu pnu ppuu pupu n n n u u u u u u u u u u e.g. (+ pp) =p (- np) = n (- (+ n u) p) = u (+ PPP) = error (+34) = error (* 2 p) = error (+ a b) = error You will need to modify the following files: (6 pt) Grammar file (Abstract Lang.g) . (4 pt) AST file (AST.java) (3 pt) Printer file (Printer.java) (3 pt) Value file (Value.java) (10 pt) Evaluator (Evaluator.java) 7 - 1 n 1 package arithlang; 2 3 import static arithlang. AST.*; 4 5 public class Printer { 6 public void print (Value v) { System.out.println(v.toString()); } 10 public static class Formatter implements AST.Visitor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
