https://github.com/rami3l/golox
A VM-based interpreter for the Lox Programming Language.
https://github.com/rami3l/golox
crafting-interpreters go golang interpreter lox lox-language programming-language
Last synced: about 1 year ago
JSON representation
A VM-based interpreter for the Lox Programming Language.
- Host: GitHub
- URL: https://github.com/rami3l/golox
- Owner: rami3l
- Created: 2022-08-01T13:15:51.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-05T00:44:11.000Z (almost 4 years ago)
- Last Synced: 2025-05-13T00:05:19.401Z (about 1 year ago)
- Topics: crafting-interpreters, go, golang, interpreter, lox, lox-language, programming-language
- Language: Go
- Homepage:
- Size: 154 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# golox
[The Lox Programming Language](https://www.craftinginterpreters.com/the-lox-language.html) implemented in Go, based on the original `clox` implementation\*.
\* : For the tree-walking interpreter, see [`rami3l/dolores`](https://github.com/rami3l/dolores).
---
## Contents
- [golox](#golox)
- [Contents](#contents)
- [Features](#features)
- [Try it out!](#try-it-out)
---
## Features
- [x] Lexer
- [x] Pratt parser & bytecode compiler
- [x] Bytecode VM
- [x] Basic types
- [x] Floating point arithmetic
- [x] Logic expressions
- [x] Control flow
- [x] Jumps: `break`/`continue`\*\*
- [x] Functions
- [x] Classes
- [x] Instances
- [x] Instance methods
- [x] `this`
- [x] Initializers
- [x] Inheritance
- [x] `super`
\*\* : Extension
## Try it out!
With the latest [Go toolchain](https://go.dev/dl) installed:
To refresh generated source files:
```sh
go generate ./...
```
To run:
```sh
go run main.go
```
To run with debug info:
```sh
go run -tags DEBUG main.go -v=debug
```