subject

Exercise 3. (evaluation of arithmetic expressions with variables) let us consider an arithmetic expression described by a tree constructed from tuples as follows: 1. an integer is described by a tuple int(n), where n is an integer. 2. an addition is described by a tuple add(x y), where both x and y are arithmetic expressions. 3. a multiplication is described by a tuple mul(x y), where both x and y are arithmetic expressions. 4. a variable is described by a tuple var(a), where a is an atom giving the variable name. an environment is a record with a label env and for each variable name there is a feature which corresponds to an integer value. for example, the record env(a: 2 b: 4) says that the variable "a" has value 2, whereas the variable "b" has value 4 (note that the oz features should start with a lowercase letter). for example, add(var(a) mul(int(3) var( is an arithmetic expression containing two variables (namely a and b) and its evaluation returns 14. give a specification and an oz implementation of a function eval that takes as arguments an arithmetic expression and an environment, and returns its value. for example, the call {eval add(var(a) mul(int(3) var( env(a: 2 b: 4)} should return 14.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Communication is the exchange of information. true false
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
Amedian in the road will be marked with a white sign that has a black arrow going to the left of the median. true false
Answers: 1
question
Computers and Technology, 23.06.2019 01:10
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
You know the right answer?
Exercise 3. (evaluation of arithmetic expressions with variables) let us consider an arithmetic expr...
Questions
question
Mathematics, 05.07.2019 01:30
question
English, 05.07.2019 01:30