[<-] [ ^ ] [->] Previous: Use in Teaching Up: Use in Teaching Next: Assignment Plan
Design of an Interpreter
Perhaps, the significant rite of passage of second year students is the
creation of an interpreter for a small-scale language, the step by step
translation of an input stream of characters to a runnable program. This is
non-trivial task. As such it is an excellent test bed for the various
software tools, make, sccs etc., which they have already
learned. It is also an excellent opportunity for them to produce an
integrated design document. But for them to have any hope of doing this,
they need some fairly well worked out examples, or even templates. The
mini-language framework comes in quite useful here. We can provide a
detailed template for the basic mini-language, CORE used by Marcotty
Ledgard[2]. CORE contains only integer data types, has no nested
scopes, functions, procedures and only the simplest of control structures.
As such it is sufficiently small for the entire design document to be
readable as a precursor to carrying out an assignment in language analysis and
interpretation.
The C++ version used here is a fairly direct transcription of the
Modula-2 version written by Malcolm Newey, used as a programming example
(without documentation) in second year since 1987. The CORE sources and
makefile are available by anonymous ftp from URL ftp://dcssoft/pub/techreports/core.tar.Z