The example
This project provides the core of an implementation of the language JOOS, which is an
acronym for Java's Object-Oriented Subset. JOOS is a proper
subset of Java, defined as follows:
- its context-free syntax is restricted to the following
grammar;
- subclassing must not change the signature of a method;
- local declarations must come at the beginning of the
statement sequence in a block;
- protected fields cannot be accessed from outside of their class or
its subclasses; and
- every path through a non-void method must return a value.
In addition, JOOS defines a concept of extern classes, which
provide a convenient interface to the Java libraries without
requiring the compiler to parse Java class files. An extern class
looks like this:
// java.lang.Integer - Section 20.6, page 487
extern public final class Integer in "java.lang" {
public Integer(int value);
public String toString();
public boolean equals(Object obj);
public int intValue();
}
It defines a class name and some method signatures, along with
a file name that is guaranteed to provide the implementation. The
JOOS compiler will implicitly trust this specification. If it is
incorrect, then the compiled JOOS class file may fail at
class loading time.
|