https://github.com/corani/olox
Lox in Odin
https://github.com/corani/olox
interpreter language lox odin
Last synced: 4 months ago
JSON representation
Lox in Odin
- Host: GitHub
- URL: https://github.com/corani/olox
- Owner: corani
- License: mit
- Created: 2022-07-14T06:30:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-03T11:09:59.000Z (almost 3 years ago)
- Last Synced: 2025-01-09T20:48:26.386Z (5 months ago)
- Topics: interpreter, language, lox, odin
- Language: Odin
- Homepage:
- Size: 180 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Olox
The [Lox](https://craftinginterpreters.com/) interpreter in [Odin](https://odin-lang.org/).
The repo for the "Crafting Interpreters" book can be found here: https://github.com/munificent/craftinginterpreters
Disclaimer: I started on this knowing absolutely nothing about Odin and am using this project
as a way to get to know the language. The implementation therefor is definitely not idiomatic
Odin, and probably very inefficient and "ugly".If you're an Odin expert, feel free to point out what could be done better!
## Setup
Make sure you have llvm and clang installed. I had to do the following to get it to work properly:
```bash
$ sudo apt install llvm-11 clang-11
$ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 100
$ sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-11 100
```Install Odin from source:
```bash
$ git clone https://github.com/odin-lang/Odin
$ cd Odin
$ make
```Make sure to add the `Odin` folder to your path (or *symlink* the Odin executable from a location
in your path).## Compile and run
```bash
$ ./build.sh
$ bin/olox examples/fix.lox
```## TODO
Look at subtype polymorphism and vtables