REJO language is an extension of the Java language, i.e. Java programs may be compiled by the REJO compiler without problem (it must only have the rejo extention). Since REJO language is a superset of Java grammar its implementation was performed using a generator of compilers and the Java grammar described in the choosen generator. The most known generator of compilers is the pair YACC and LEX [19], however REJO implementation does not use them, it uses JavaCC[18]. We chose JavaCC because it uses, as native language, Java language and not C language (which is not as portable as Java) as in YACC/LEX and because the JavaCC grammar is easier than YACC grammar.
In this page we present a brief description of the REJO compiler implementation.
The java grammar is mainly composed by 4 parts:
In order to implement REJO languaje, the java grammar was modified to:
You may look an old version of REJO grammar (in html format) here.
Statistics
The following table shows the number of production rules used by Java and REJO. As you can see REJO defines less than the half Java productions because it reuses Java productions. The only case where REJO has more productions rules is in the definition of Flow Control Structures; this is normal because REJO is richer describing behaviors.
Java production rules
|
REJO production rules
|
|
Structure of a Program |
39
|
14
|
Expressions |
31
|
9
|
Flow Control Structs |
15
|
10 + Reactive Instructions 10 |
Total
|
85
|
43
|
The whole grammar has 131 rules.