CS440 Programming Languages - Midterm Exam - Part 3: Interpreter modifications
This question has been solved
CS 440 Midterm Exam (Take-Home)
CourseNana.COM
This midterm exam consists of 7 separate exercises --- 3 on recursion and lists, 3 on higher order functions, and 1 involving an addition to an interpreter. They are described below:
CourseNana.COM
Part 3: Interpreter modifications
CourseNana.COM
For this part you will add a case expression to the same interpreter provided for MP2. A
CourseNana.COM
case expression has the following form:
CourseNana.COM
(case TEST-EXPR [INT-VAL1 EXPR1] [INT-VAL2 EXPR2] ...
CourseNana.COM
[else ELSE-EXPR])
CourseNana.COM
The TEST-EXPR is first evaluated, and its result is compared to the various INT-VALs --- if one matches, the corresponding EXPR is evaluated and becomes the result of the case expressions. If none of the INT-VALs match, the ELSE-EXPR is evaluated.
CourseNana.COM
E.g.,
CourseNana.COM
> (case 1 [1 10] [3 20] [5 30]
CourseNana.COM
[else 40]) 10
CourseNana.COM
> (case (+ 2 3) [1 (* 2 3)] [3 (+ 3 4)]
CourseNana.COM
[5 (* 2 (+ 3 8))]
CourseNana.COM
[else (+ 30 10)])))) 22
CourseNana.COM
●
You may choose to implement the case statement either by desugaring it to if expressions or by modifying the eval function directly. If you choose to use desugaring, feel free to reuse your code from MP2.
CourseNana.COM
IIT代写,US代写,CS440代写,CS 440代写,Programming Languages代写,Racket代写,Interpreter modifications代写,IIT代编,US代编,CS440代编,CS 440代编,Programming Languages代编,Racket代编,Interpreter modifications代编,IIT代考,US代考,CS440代考,CS 440代考,Programming Languages代考,Racket代考,Interpreter modifications代考,IIThelp,UShelp,CS440help,CS 440help,Programming Languageshelp,Rackethelp,Interpreter modificationshelp,IIT作业代写,US作业代写,CS440作业代写,CS 440作业代写,Programming Languages作业代写,Racket作业代写,Interpreter modifications作业代写,IIT编程代写,US编程代写,CS440编程代写,CS 440编程代写,Programming Languages编程代写,Racket编程代写,Interpreter modifications编程代写,IITprogramming help,USprogramming help,CS440programming help,CS 440programming help,Programming Languagesprogramming help,Racketprogramming help,Interpreter modificationsprogramming help,IITassignment help,USassignment help,CS440assignment help,CS 440assignment help,Programming Languagesassignment help,Racketassignment help,Interpreter modificationsassignment help,IITsolution,USsolution,CS440solution,CS 440solution,Programming Languagessolution,Racketsolution,Interpreter modificationssolution,