This project offers a comprehensive survey on the 10 most common-used approaches to give programs formal semantics.
- Ocaml
- Haskell
- Maude
- Racket
- Python
- Prolog
- Java
- C/C++
- Big-step SOS
- Small-step SOS
- Denotaional semantics
- MSOS
- Reduction semantics with evaluation contexts
- CK
- CEK
- SECD
- SCC
- CHAM
- Start with IMP without
while
. Ask vonlunteers to add the semantics ofwhile
. When everybody is done, freeze a canonical version of the semantics and call the language IMP for all. - Add incremental statement
++x
to IMP. - Add I/O with
read()
andprint(e)
to IMP (at 1, not 2). - Add abrupt termination with division-by-zero
error
andhalt;
to IMP. - Add threads with
spawn(code)
andjoin;
to IMP. - Add local variable declarations to IMP.
- Combine 2-6 all together, and call the language IMP++.
- Start with LAMBDA with basic constructs, including
\lambda
and\mu
binders, application, substitution, and builtins. - Add concurrency with
spawn
andjoin
to LAMBDA. - Add
call/cc
to LAMBDA. - Combine 2-3 all together, and call the language LAMBDA++.
- Tests are very important. We will provide a comprehensive set of programs that test every corner cases of the semantics.
- Syntax of the languages are very important. We will provide it for every language construct.
- Nondeterminism behavior is very important. The ability to search for all possible execution results is required. For some semantic approaches such as big-step SOS and denotational semantics, full nondeterminism is almost impossible in practice, but at least the choice nondeterminism should be handled properly.
- We require two artifacts:
- Semantics implementation should pass all provided tests.
- An essay that describes and scores every semantic approach with explanation and justification.
To fulfill the requirement, you should
- pick an implementation language
- pick a semantic style from either big-step or small-step SOS
- implement the semantics of IMP++ directly, that is, you don't need to do it incrementally.
The following is a list of students who participate in the project. If you are taking the project but your name is not in the following list, please add it yourself.
- Armrin: big-step in Racket.
- Binzhe: TBD in Python.
- Nick: small-step in Haskell.
- Siwakorn: small-step in Racket.
- Xiaohong: big-step in OCaml.
- Dan: big-step in Haskell.
Please put your code in a folder structure like <IL>/<CL>/<part#-part descriptor>/<semantic#-CL-semantic name>/
where IL is the implementation language (e.g. haskell) and CL is the created language (i.e. imp or lambda). This is the same format as the Maude homeworks from class.
For example, the code for implementing IMP++ in Haskell using big-step semantics would be found under haskell/imp/6-imp++/1-imp-bigstep/
.