Yuri Tsoglin

Research thesis

JAMOOS - an Object Oriented Language for Grammars

Supervisor: Dr. Joseph (Yossi) Gil

The research was done in:
Systems and Software Development lab. (SSDL)
Faculty of Computer Science
The Technion, Israel Institute of Technology


Table of contents:


Abstract

    In the recent years, the natural correspondence between BNF grammars and object-oriented class hierarchies has been widely explored. The main principle this correspondence revolves around is that a grammar production also defines a class. The left-hand side of the production declares the name of the class, and the right-hand side defines the features of the class. Further, an alternation production of the form  A -> B | C  defines an inheritance relationship between classes. Other productions such as  X -> Y Z  define aggregation relationships between classes.

    In this thesis, we introduce JAMOOS, a new programming language, which presents a computing metaphor bringing the unification of the concepts of BNF and of object-oriented programming to its fullest extent. Insisting on equating the concepts led to a unique general purpose object oriented language, which much like SMALLTALK revolves around a small number of cohesive principles. These principles, however, are quite different from those of SMALLTALK, and indeed of most other object oriented programming languages. Due to the dual nature of JAMOOS programs, JAMOOS can be used as a compiler-compiler, as well as a general purpose programming language.

    A JAMOOS program comprises definitions. Each definition defines simultaneously a grammar production in extended BNF form, an object-oriented class, and a routine in terms of procedural programming. Further, almost each element of a JAMOOS definition has simultaneously two or three meanings, corresponding to the above interpretations. For example, a lexical regular expression appearing in the right-hand side of a definition is both a grammar non-terminal and an entity of type STRING; an executable code fragment can be thought of as a void function as well as a semantic feature of an attribute grammar.

    In addition, JAMOOS has built-in support for different issues which are an essential part of any language processing task, but are not addressed directly by most existing language processing tools. One such issue is that of error handling. JAMOOS uses the novel concept of error types, which enables analyzing an incorrect input in a straightforward manner. Syntax errors and semantic errors, which are totally different in their nature, are handled by exactly the same mechanism. Another built-in support is for symbol-table management: JAMOOS has internal mechanisms for generating a symbol table and performing operations on it.

    The main computing metaphor used by JAMOOS is that of constructor calls and tree computation. A JAMOOS computation comprises nested constructor calls, which result in the generation of an abstract syntax tree. Each constructor call builds an object which becomes a node in the tree, and all the contained objects build up its subtree. All objects in JAMOOS are immutable, i.e., after an object is constructed, its value cannot be changed. Thus, JAMOOS is useful mainly for representing static structures. Inputs in a language defined by a given grammar, which are still assumed to be the main subject of using JAMOOS, are an obvious case of such static immutable structures.

    Since one of the main purposes of JAMOOS is language specification and compiler generation, it should have special support for the specific parsing issues, such as parse conflict resolution. In addition to the usual priority-based method of resolving parse conflicts, JAMOOS has also a mechanism for resolving parse conflicts using semantic information.


Seminar lecture slides

The slides are available in several formats:

Final thesis paper

The final thesis paper, submitted to the Senate of the Technion, is available in several formats: The thesis has a part in Hebrew (extended abstract). For non-Hebrew readers, English-only version is available:

Software and resources used and developed in this research

JAMOOS source code

Implementation of JAMOOS is still under development. In this thesis, only partial implementation has been done. JAMOOS is implemented using Microsoft Visual C++ 6.0.
Visual C++ project file (jamoos.dsw) is included.

Software used by JAMOOS