A small-step semantics work by returning the program with one step of evaluation done. Function calls and let's work by substituting the value for the variable into the body. The output is always an AST. To evaluate fully, one applies the small-step rules until no other rule is possible, which happens when there is a type error, or we end up with a value such as const(42). There are two kinds of values for Language Three: constants and functions.
The small-step semantics for
Language Three is as follows, where
means any expression, and
means the expression must be a value, and
means the expression
must be an integer constant.
In lecture, we implemented these rules in Prolog.
The solution will be made available on the web.
For this Homework, you will add conditionals and recursion.
true and false.
We add a form for recursive functions:
fun