Programming Language for Old Timers


by David A. Moon
February 2006 .. September 2008

Comments and criticisms to dave underscore moon atsign alum dot mit dot edu.


Previous page   Table of Contents   Next page


Program Syntax

A program source file consists of a sequence of expressions.

Any top-level expression can be preceded by the keyword module:, in which case the expression must evaluate to a module and the remaining expressions are parsed in that module. The expression can be a defmodule or a name whose definition is a module.

If the keyword syntax: appears at the top level of a program, it is followed by a name. If the name is xyz, the remainder of the source file is parsed by calling parse-xyz rather than parse-expression. This allows switching to an alternative user-defined syntax without having to change the compiler. Any parsing function that returns a P-Expression can be used.

Any top-level expression can be preceded by the keyword export:, in which case the expression must parse as a name, a definition, or a collation containing definitions. Each name defined is exported from the current module, except in a collation any names after the first that start with _ are not exported; this allows putting export: in front of a defclass to export the class, the constructor, and any public slots, but not private slots. If the expression is just a name, that name is exported from the current module.

Program syntax requires consistent indentation, so each top-level expression must be on a separate line and all top-level expressions must begin at the first column.


Previous page   Table of Contents   Next page