https://github.com/bp7968h/jlox
Jlox interpreter from the book Crafting Interpreters
https://github.com/bp7968h/jlox
interpreter java programming-language
Last synced: 6 months ago
JSON representation
Jlox interpreter from the book Crafting Interpreters
- Host: GitHub
- URL: https://github.com/bp7968h/jlox
- Owner: bp7968h
- Created: 2024-09-17T21:58:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-06T20:54:13.000Z (over 1 year ago)
- Last Synced: 2025-03-04T12:45:59.542Z (11 months ago)
- Topics: interpreter, java, programming-language
- Language: Java
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jlox Interpreter
This project is an implementation of the jlox interpreter from the book Crafting Interpreters by Robert Nystrom. jlox is a tree-walk interpreter for the Lox programming language, which is dynamically typed and supports object-oriented and functional programming.
## Features
- Supports expressions, statements, and control flow.
- Dynamically typed variables.
- First-class functions and closures.
- Object-oriented programming with classes, inheritance, and methods.
- Error handling for both runtime and syntax errors.
## Prerequisites
- Java 8 or higher installed on your machine.
## Running jlox
1. Clone this repository:
```bash
git clone https://github.com/bp7968h/jlox.git
cd jlox
```
2. Compile the interpreter:
```
javac -d out src/lox/*.java
```
3. Run the interpreter:
```
java -cp out lox.Lox
```
4. To run a Lox script, provide the script file as an argument:
```
java -cp out lox.Lox script.lox
```
## Usage
You can use jlox interactively or run .lox files. In interactive mode, type Lox code directly into the terminal:
```bash
> print "Hello, World!";
Hello, World!
> var x = 10;
> print x + 2;
12
```