-
Notifications
You must be signed in to change notification settings - Fork 5
/
hw-mutation.scala
38 lines (38 loc) · 1.18 KB
/
hw-mutation.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// HOMEWORK ASSIGNMENT
// ===================
//
// Email homework as Scala source file to:
//
//
// Work in groups of 1 or 2 students. Send the email CC to the
// other student in your team. Hand in before the morning of
// Monday, December 15.
//
//
// Put "pl1-hw05" in subject, please
//
// 0. write in the email:
// - your names
// - your student ids ("Matrikelnummer")
// 1. Implement assignment to arbitrary variables.
//
// Three different ideas for how to implement assignment:
//
// 1st idea: Add
//
// case class Assign(lhs: Symbol, rhs: Exp) extends Exp
//
// and change the interpreter so that the environment maps names
// to adresses, and the real values are in a store that maps
// adresses to values.
//
// 2nd idea: Implement assign as syntactic sugar so that every
// expression creates a box with the real result, and then use
// the interpreter for the language with boxes from the lecture.
//
// 3rd idea: Implement assign as syntactic sugar so that every
// value in the environment is in a box, and then use the
// interpreter for the language with boxes from the lecture.
//
// Send question by email to [email protected]