GitXplorerGitXplorer
j

jlox

public
2 stars
1 forks
0 issues

Commits

List of commits on branch main.
Unverified
4416fb0e5fbfda3040f376f160b8bea2b8f5b7c1

Use a custom stack to avoid potential synchronization overhead

jjbduncan committed 3 years ago
Unverified
53e26b4b43de07c2e7a43ddfe47b168684adb5f0

Remove Guava from lox module, where it isn't needed

jjbduncan committed 3 years ago
Unverified
36b80d9dd6c7e321a58aa8d100c5783d2349110d

Convert codebase to use Java 17 features

jjbduncan committed 3 years ago
Unverified
4deddf4f9de96102cadeff39122cebce6ce7ef26

Upgrade Java, Gradle and all dependencies

jjbduncan committed 3 years ago
Unverified
fc384725a846f1e8f13f8ae82d4b45f55031f15c

Add TODO

jjbduncan committed 4 years ago
Unverified
ec1efe299d80b828512bec9fb3e595452f7065c6

Minor cleanup

jjbduncan committed 4 years ago

README

The README file for this repository.

jlox

This is my Java 17 implementation of Lox - a small programming language for scripting - from the book Crafting Interpreters.

One big difference between the reference implementation of jlox and this one is, whereas the reference implementation generates the Expr and Stmt classes by concatenating strings together, this implementation uses JavaPoet, a Java library for generating Java source files in a more type-safe way.

Prerequisites

  1. Install a distribution of Java 17. One way to do this is:
    1. Install asdf-vm.
    2. Run asdf plugin add java.
    3. Now, when you "cd" into this directory and run asdf install, running java will use the asdf-managed version specified in .tool-versions.
  2. Setup your favourite IDE or text editor to use this distribution of Java 17.

Build the executable

./gradlew build

Run the executable as a REPL

java -jar lox/build/libs/lox-0.1.0-SNAPSHOT.jar

Alternatively, run the Java file com.craftinginterpreters.lox.Lox in your IDE of choice.

Run the executable with a Lox script

java -jar lox/build/libs/lox-0.1.0-SNAPSHOT.jar <path-to-lox-program>