Skip to content

A language interpreter I created without having any idea what I'm doing

License

Notifications You must be signed in to change notification settings

danilhendrasr/yali4j

Repository files navigation

yali4j

Yet Another Lox Interpreter, written in Java.

Stargazers Issues MIT License LinkedIn

About The Project

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.

(back to top)

Getting Started

Prerequisites

  • JDK 11 or above;
  • Gradle.

Build from source

  1. Clone the repo and cd into the directory;
  2. Run gradle build;
  3. The resulting jar file is located in the build/libs/yali4j-0.1.0.jar;
  4. Run the jar file by using:
    java -jar yali4j-0.1.0.jar
  5. Test out the language by typing the following:
    print "Hello world!";

Using Pre-built Binaries

  1. Go to the releases page;

  2. Download any version you want to test out;

  3. 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
    

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Twitter LinkedIn Email

Acknowledgements

(back to top)