For using the compiler:
Java JDK 17
Python 3.12
- torch - 2.3.0
- pandas - 2.2.2
- torchvision - 0.18.0
Can be installed using the following command:
pip install torch==2.3.0 torchvision==0.18.0 pandas==2.2.2
Additional requirement which only necessary if wanting to build or test the compiler
Maven 3.9.6
It's important to add Maven to the path
in the system environment variable.
Antlr 4.13.1
It's important to add Antlr to the classpath in the environment variable.
Either to the system variable by adding the path to the CLASSPATH
.
Alternative a local classpath for this shell session can be set using the following command:
CLASSPATH=$CLASSPATH:<path_to_current_directory>/antlr-4.13.1-complete.jar
A pre-built jar file can be found here: example/NeuroScript.jar
.
To use the compiler use this command in the same folder as NeuroScript.jar:
java -jar NeuroScript.jar <file path>
To run the example go into the ´example´ folder and run the following command:
java -jar NeuroScript.jar example
It should generate a Python file with the name example.py
in the same folder. The file should contain the same code
as expected_outcome.py
.
The example can then be run using the following command:
python example.py
If it fails, test the python environment using the following command:
python expected_outcome.py
Firstly the Antlr files has to be generated using the following command in the root folder:
java -Xmx500M org.antlr.v4.Tool Grammar.g4 -o src/main/java/org/g5/parser -package org.g5.parser -visitor
Once the project is setup it can be build into a usable jar file using maven:
mvn clean package
Which should generate a jar file on the path:
- With dependencies:
target\NeuroScript-jar-with-dependencies.jar
- Without dependencies:
target\NeuroScript.jar
For use in compilation it's recommended to use NeuroScript-jar-with-dependencies.jar
as it contains all the
dependencies. Remember to change the name of the jar file when using the compilation command.
To run all tests use the following command in the project root:
mvn test