-
Notifications
You must be signed in to change notification settings - Fork 8
Building
To use Arden2ByteCode, first download or clone the source.
-
Using Eclipse:
- Copy the following URL into your clipboard (
ctrl + c
): https://github.com/PLRI/arden2bytecode.git - In Eclipse go to File ⇒ Import… ⇒ Projects from Git ⇒ Clone URI. The fields should automatically contain the URL you copied, so click Next.
- Select the master branch and click Next again.
- On this page enter a location for the repository and check Clone submodules if you also want to download the examples submodule. Then Click Next.
- Choose Import existing Eclipse projects and click Next.
- Select the arden2bytecode project and click Finish.
- The project should now be imported and opened on the left side of your Eclipse IDE window (Package Explorer).
- Copy the following URL into your clipboard (
-
Using the command line
You can clone the source and the submodule with the examples, with Git as follows:
git clone --recursive https://github.com/PLRI/arden2bytecode.git
-
Downloading the files
Alternatively, you can download a zipball or tarball from the following URLs:
Zipball: https://github.com/PLRI/arden2bytecode/zipball/master
Tarball: https://github.com/PLRI/arden2bytecode/tarball/master
Extract the files to a directory of your choice.
You can also import these files in Eclipse via File ⇒ Import… ⇒ Existing Projects into Workspace.
Now that you got the source, you can build (compile) it. You first need to generate the parser using the SableCC parser generator. There are 2 different ways to build it:
-
Using Eclipse (recommended)
- Build the project by selecting it in the Package Explorer and then choosing Project ⇒ Build project from the Eclipse menu.
- On the first build you need to refresh the Project (
F5
), so Eclipse finds the downloaded dependencies.
-
Using Apache Ant
Ant is a command-line utility mainly used to compile Java programs like Arden2ByteCode.- First of all, you need to have ant installed and the binary being in the path of your environment.
- Further, you need a Java Development Kit of at least version 7 to be able to compile the Java Sources.
- Using the command line, switch to the project directory (build.xml should be located in that directory).
- Type
ant
, to start the compile procedure. - The compiled Java program should now reside in subdirectory
bin/
of the source tree.
Both will automatically call the "sableCC" target in the build.xml and generate the .java files for the parser in the packages analysis
, lexer
, node
, parser
. This can take some time, but will only happen if the .java files do not exist or are out-of-date.
When the input grammar is changed, you will need to regenerate the parser. Before regenerating the parser, you should call the "clean" target (Project ⇒ Clean… in the Eclipse menu or ant clean
using the command line) to ensure there aren't any old files left behind.
To create a JAR package file and helper scripts to launch it, call the jar
target in the build.xml:
-
Using Eclipse
- Open the build.xml.
- Look for the Outline view on the right. If it is not there, open it with Window ⇒ Show View ⇒ Outline.
- Right-click on the
jar
target in the outline and select Run As ⇒ Ant Build.
-
Using the command line
- Switch to the project directory (build.xml should be located in that directory).
- Type
ant jar
.
The distributable files will be built in the in the dist/
subdirectory.
To create distributable .tar.gz and .zip files which contain MLM examples, the JAR file and launch scripts, call the dist
target.
Having built the source or a JAR file you can now launch the Arden2ByteCode compiler.
-
Launching the class-files
- On the command line switch to the project directory.
- Enter
run.bat -r <Path to an MLM-File>
(Windows) or./run.sh -r <Path to an MLM-File>
(Linux, MacOS).
E.g../run.sh -r resource/examples/hello_world.mlm
-
Launching the JAR file
You can also launch the .jar binary package as explained in Installation.- Switch to
dist/
subdirectory. - Type
arden2bytecode -r <Path to an MLM-File>
(Windows) or./arden2bytecode -r <Path to an MLM-File>
(Linux, MacOS) on the command line to run it.
- Switch to
More information about using the compiler is given in the Command Line Options wiki page.
Getting Started
Arden Syntax
Development