Tiny Java Specification


There are only three primitive types (boolean, char, int) and no class types. Single-dimensioned arrays may be added later.

A compilation unit consists of a single class declaration with no constructors:

class name { body}
The body may consist of only field declarations and method declarations. Fields and methods must be declared before used (this may be relaxed later to accomodate recursive methods). There are no modifiers in front of declarations. There are no exceptions to throw nor catch.

Assignments do not have value and cannot be concatenated as in x=y=e

The only statements are:

name = expression;
if (boolexpn) statement else statement
while (boolexpn) statement
return expression;
{ statements }
We may add switch and break later.

The only operators are, besides parentheses:

(integer)  + - * / %
(boolean)  &&  ||  !
(relation)   ==  !=  <  >  <=  >=

Integer constants (literals) consist only of decimal digits. Character constants consist only of the character enclosed in apostrophes (for example: 'a'), or one of the three escaped characters '\n', '\'', and '\\'. Type-casting expressions are not in the language.

Rev. 2003 February 4