WHAT is JavaH:

JavaH is an implementation of the meaning preserving transformation E[1] for JavaM. E maps programs of JavaM into programs of ordinary Java 1.4. JavaM is Java (presently, full version 1.4) extended with the mechanism of m_parameter[1], i.e. the ability to pass methods as parameters in Java methods. The main syntactic extensions are summarized, by the grammar rules, below:

  

Type: ... | fun [Type {,Type }] -> (Type | void)

Modifier: ... | functional

LocalVariableDeclarationStatement:

var [final] type VariableDeclarators

Arguments:

((Expression|abs Identifier){,(Expression|abs Identifier)})

 

 

CONTENT:

 

-- JavaSyntax.yacc & JavaLex.lex

yacc_ and lex_ developed source experimental beta version of the preprocessor JavaH mapping programs written in JavaM into programs written in Java 1.4;

-- SymTab.h, Symtab2.h

auxiliaries files, respectively, for the list of tokens of JavaM, the list of structures and the list of operations involved in the preprocessor JavaH;

-- com.exe

an executable code of JavaH only for UNIX Darwin under OS X Tiger;

-- makefile

a make file for executable versions of JavaH;

 

 

REQUIREMENTS:

 

-- unix

for running all the tools;

-- c, cc - a compiler for c

for a new object code of the preprocessor JavaH

- Java 1.4.0

for compiling the Java programs, once preprocessed using JavaH 

 

 

OPERATIONS for UNIX Darwin under OS X Tiger:

 

1. Run 'com.exe XXX.java YYY.java'

for a file XXX of text containing an arbitrary program P* in JavaM. It yields a new file YYY of text containing the program P in ordinary Java 1.4. P is equivalent to P* but all the method parameters of P* are replaced according to the meaning preserving transformation E, described in [1] and implemented, here, by the code JavaM. At this point:

 

2. Run 'javac -source 1.4 YYY.java'

it produces an executable of program P or, equivalently, of P*. 

 

 

OPERATIONS for UNIX

 

0. Run 'make'

for obtaining comp.exe: a UNIX executable code of the preprocessor JavaH. Hence, follow the steps 1. and 2. as for UNIX Darwin.

 

 

FINAL NOTES:

 

(1) By effect of step 1., two additional files are generated: CHECK and ABSTRACT. These files are for documentation on the source program and on the execution of the preprocessor as far as it runs. In particular, CHECK furnishes a trace of the transformation while ABSTRACT contains the analysis tables and the abstract syntax of the source program, mainly classes and methods. These file can be totally, ignored.

 

(2) In getting this implementation, for documentation sake, we choose to use, for the syntax of Java 1.4, the official grammar distributed in [2]. In particular, we use the same syntactic categories and rules of [2] pagg.499-456 but for those that are using underscore in the name. File JavaSyntax.yacc contains the grammar rules in the same order that they have in [2].

 

(3) JavaH has been designed as a one-pass preprocessor from scratch and for experimental use in high order programming with Java. Hence, it is equipped with a pretty printer that shows the translated code in a structured and quite readable form.

                                            

 

REFERENCES:

 

[1] Bellia, M. and M.E. Occhiuto, Methods as Parameters: A Preprocessing Approach in Java. CS&P2007, vol.1, 2007, pp. 47-58

[2] Gosling, J., Joy, B., Steele, G. and G. Bracha, the Java Language Specification - 2nd edition, Addison-Wesley, 2000.