Yet Another Lox Interpreter, written in Java.
yali4j is just another Lox interpreter written in Java. Initially I wanted to claim that it's "a new programming language written in Java" because it sounds cooler :p, but it's not.
Lox is a programming language defined in Bob Nystrom's book, Crafting Interpreters. It's a language created for learning purpose , and not used in real industry-standard environment like Java, Python, or any other major programming language does.
As for this interpreter, it's a tree-walking interpreter, which kicks up the core interpreter right after parsing is done, it walks through the AST while evaluating each node as it goes through. There's no compilation step, no bytecode generation, let alone machine code generation or any similar fancy stuff.
- JDK 11 or above;
- Gradle.
- Clone the repo and
cd
into the directory; - Run
gradle build
; - The resulting jar file is located in the
build/libs/yali4j-0.1.0.jar
; - Run the jar file by using:
java -jar yali4j-0.1.0.jar
- Test out the language by typing the following:
print "Hello world!";
-
Go to the releases page;
-
Download any version you want to test out;
-
After download is finished, run the following command:
java -jar yali4j-x.x.x-release-name.jar
The above command will run yali4j in REPL mode. If you wanted to run a file, run the following command,
java -jar yali4j-x.x.x-release-name.jar hello_world.lox
Distributed under the MIT License. See LICENSE for more information.