Semantics

Semantics is the meaning of program phrases. We can distinguish two types of semantics:

We will focus on operational semantics, as this corresponds to definitional interpreters.

Untitled

Later in the course, we will add a Desugaring functionality (dynamically-typed):

Untitled

And finally after that we will add a type checker to our language, to make sure that before interpreting our program will not crash (statically-typed):

Untitled

As previously said, we want to build an interpreter. This is simply a method that, given a parsed expression ExprC, returns the corresponding Value:

Untitled

Semantics is useful in various ways:

Untitled

Interpretation vs Compilation

We distinguish:

Some differences between the two: