Question: 1. In this assignment, you will develop an interpreter for a small language, called SpartanLang. The valid expressions for SpartanLang are given in Figure
1. In this assignment, you will develop an interpreter for a small language, called SpartanLang. The valid expressions for SpartanLang are given in Figure 1. SpartanLang supports mutable references. The state of these references is maintained in an environment, a mapping of variables to values. With mutable references, other language constructs become more useful, such as sequencing operations (e1; e2). Expressions values e ::= assignment variable dereferencing (i.e. getting a variable's value) sequential expressions binary operations conditional expressions while expressions I := e !x e; e e op e if e then e else e end while e do e end v ::= Values integer values boolean values i b op ::= +|- | * | > | >= | < |
Step by Step Solution
3.56 Rating (170 Votes )
There are 3 Steps involved in it
To create an interpreter for SpartanLang you need to implement an evaluate function that interpre... View full answer
Get step-by-step solutions from verified subject matter experts
