This is the zip file. It
contains the source code
This is the jar file. It contains the bytecode
Here are some *.trifiles for you to try with the Triangle compiler:
To run the TriangleCompiler/Interpreter (you must have Java):
· Download the jar file onto your computer
· Using the command prompt type the following command inthe directory where you saved Triangle.jar (you may need to use ‘cd <yourdirectory>’):
· Download one of the (dot).tri files listed above orcreate your own in the same directory
To compile it type:
C:\myDirectory>java Triangle.Compiler mySourceCode.tri
To run the compiled code (saved as
C:\myDirectory>java TAM.Interpreter obj.tam
· That's it. You can now run any source code you find inthe book. If anyone knows how Example Three works, let me know.
To compile theTriangle Source Code:
· Download the Triangle-src.zip file onto your computer
· Unzip the file into a folder (preferably the C drivefor easy access). Rename it if you like.
· Using the command prompt type the following command inthe directory where you’ve unzipped Triangle-src.zip (you may need to use ‘cd<your directory>’):
C:\myTriangle>javac –classpath TAM\*.java
This compiles all the java files
located in yourTAM directory. At this point, you may want to verify this using
Similarly, you can compile the
C:\myTriangle>javac –classpath “.” Triangle\*.java
The extra “.” is necessary because Triangle hasfive subdirectories with java files as well, and this tells the compiler tolook for those as well.
· That’s it. You can now run the Triangle.Compiler and TAM.Interpreter using the commandsmentioned in the previous section
C:\myTriangle>java TAM.Interpreter obj.tam
You may notice that your class files
and java files areknow mixed up in the same directories. If this bothers you,
you can type:
C:\myTriangle>javac –d Tools –classpath “.” Triangle\*.java
What this does is place all the class files in the empty Tools directory thatyou already have. The only thing is that you must ‘cd’ into that directorybefore you trry to run Triangle.Compiler or TAM.Interpreter because those classfiles are now there.