MANOOL is Not an Object-Oriented Language!”

General — Specification


General Program Structure

A program in MANOOL consists of one or more source files, referred to as program units (or more accurately, native program units), each written in the formal language of MANOOL forms. Thus, the MANOOL specification concerns, in fact, with syntactic structure and meaning of MANOOL forms (or equally, with syntax and semantics of the language of forms).

A MANOOL program contains a designated main program unit and all program units it depends on, either directly or indirectly (that is, recursively). The presence of circular dependencies between program units would result in a meaningless program and even may be a cause of a non-terminating behavior thereof.

Note that program units written in MANOOL may also depend on foreign program units, implemented in other programming languages. For more information on program units and their dependencies, refer to Program units, external entities.

Translation Overview and the Abstract Machine

This specification introduces the concept of a fictional device implementing MANOOL, called the abstract machine, and in a few occasions its structure and behavior are discussed explicitly. This is for illustration purposes only; by no means the MANOOL specification places requirements on either structure or internal mode of operation of conforming implementations, which instead are to emulate the observable behavior of the abstract machine.1 This in practice extends to its asymptotic complexity characteristics whenever such characteristics are explicitly specified.

To figure out the meaning of a form that makes up a program unit, the abstract machine transforms (compiles) the contents of the source file into an internal run-time representation, called run-time code.

Note that here the distinction between a compilation phase and a post-compilation (i.e., execution) phase is introduced not just for illustration purposes — in particular, some constituent expressions may actually need to be evaluated (once!) during compilation of the whole expression.2 In this specification a compilation phase is referred to hereinafter as compile-time whereas a post-compilation phase as run-time.

A three-stage translation (i.e., compilation) scheme is suggested for the abstract machine:

Semantic analysis and code generation is a compositional process; that is, to carry out the semantic analysis and code generation for a form (encoded in an AST), the abstract machine performs (among other things) the semantic analysis and code generation for its constituent forms (represented by some subtrees of the original AST). For a formal definition of this process, refer to Metacircular definition.

  1. This principle is also known as the “as-if” principle.

  2. Thus, strictly speaking, several compilation and execution phases may be interleaved in time.

  3. Each of the tokens belongs to some class, encoded as a terminal symbol from the syntactic analysis standpoint, and has an optional semantic (MANOOL) value.

  4. In MANOOL (as opposed to other languages and with a notable exception of those based on the notation of S-expressions) many aesthetic aspects of source code that are traditionally examined on the syntactic analysis stage are irrelevant to the language syntax.