Name | Modified | Size | Downloads / Week |
---|---|---|---|
examples | 2013-01-19 | ||
source | 2013-01-19 | ||
all_files.zip | 2013-01-19 | 116.5 kB | |
javamip2java.jar | 2013-01-19 | 90.9 kB | |
README.TXT | 2013-01-19 | 3.5 kB | |
Totals: 5 Items | 210.9 kB | 0 |
------------------------------ HOW TO USE THE SOURCE CODE ------------------------------ To generate the preprocessor you will need javacc and jjtree which can be downloaded here: http://javacc.java.net/ After you have installed and added to your path the jjtree and the javacc commands, open a command prompt in the source code folder and use the following commands: jjtree *.jjt javacc *.jj javac *.java The first command will preprocess the .jjt file to create the AST code and will generate a .jj file. The second command will generate the parser from the .jj file. The third command will generate the .class files. Now the preprocessor is ready and you can translate .jmip files to .java files through the following command: java Main filename.jmip ***NOTE: the original sourcecode folder (I mean before using the jjtree and javacc tools) contains the following handwritten files: JavaMIP.jtt (partly handwritten, it is an edited version of the JavaParser supplied with JavaCC) SymbolTableFiller.java SymbolTable.java IniModule.java AllocationCall.java FormalParameter.java IniParameter.java ASTMIPFormalParameter.java (partly handwritten, the skeleton was generated by jjTree then I added the custom code) ASTMIPInitializationModule.java (partly handwritten, the skeleton was generated by jjTree then I added the custom code) ASTMIPParameterInitialization.java (partly handwritten, the skeleton was generated by jjTree then I added the custom code) CheckException.java StaticChecker.java Translator.java TranslatorException.java TranslatorVisitor.java Main.java MyToken.java (not handwritten but needed for the original JavaParser) ---------------------------- HOW TO USE THE JAR ---------------------------- Put the javamip2java.jar file in the folder with the .jmip files. Then from the command prompt use the following command: java -jar javamip2java.jar filename.jmip ----------------------------------- HOW TO USE THE PREPROCESSOR ----------------------------------- The preprocessor accepts only a single file argument. It will automatically search for its dependencies. Note that the preprocessor will search the dependencies in the same folder where the preprocessor has been launched. This is the reason we recommended to put the .jar file in the same folder of the .jmip files. The preprocessor will generate one or more .java files depending on the input. Moreover, it will generate a .info file for each .jmip file which contains a new instruction. The .info file contains the list of modules calls that the new instruction implies. For example: new AnimatedSprite[imgs:=null , frameRate:=5] required AnimatedSprite(Image[] imgs) initializes () required AnimatedSprite() initializes (img) required Sprite(Image img) initializes () optional AnimatedSprite(int frameRate) initializes (frameTime) required AnimatedSprite(int frameTime) initializes () The "required Sprite(Image img)" module is activated by the above one and the same is for the "required AnimatedSprite(int frameTime)" module. All the other modules are directly activated by the allocation call. ------------------------------- HOW TO USE THE EXAMPLES ------------------------------- To preprocess the Point example use the following command from the Point folder: java -jar javamip2java.jar PointMain.jmip To preprocess the Sprite example use the following command from the Sprite folder: java -jar javamip2java.jar SpriteMain.jmip