Skip to content

Commit 03decc6

Browse files
authored
Add references
1 parent 77578e4 commit 03decc6

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

README.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
# loxcraft
99

10-
[![crates.io][crates.io-badge]][crates.io]
10+
[![crates.io](https://img.shields.io/crates/v/loxcraft)](https://crates.io/crates/loxcraft)
1111

12-
**Language tooling** for the **[Lox programming language]**.
12+
**Language tooling** for the **[Lox programming language](http://craftinginterpreters.com/)**.
1313

1414
</div>
1515

@@ -22,20 +22,20 @@ cargo install loxcraft --locked
2222
## Features
2323

2424
- [x] Bytecode compiler + garbage collected runtime
25-
- [x] Online playground, via WebAssembly ([try it out!][lox playground])
25+
- [x] Online playground, via WebAssembly ([try it out!](https://ajeetdsouza.github.io/loxcraft/))
2626
- [x] REPL
27-
- [x] Syntax highlighting, via [tree-sitter-lox]
28-
- [x] IDE integration, via the [Language Server Protocol]
27+
- [x] Syntax highlighting, via [tree-sitter-lox](https://github.com/ajeetdsouza/tree-sitter-lox)
28+
- [x] IDE integration, via the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
2929

3030
## Screenshots
3131

32-
![Screenshot of REPL]
32+
![Screenshot of REPL](https://user-images.githubusercontent.com/1777663/216910834-4ea40427-34d7-43e0-8ba0-06638dfb0fa2.png)
3333

34-
![Screenshot of online playground]
34+
![Screenshot of online playground](https://user-images.githubusercontent.com/1777663/201918922-39b567fe-9375-4990-8224-e540cf3266bc.png)
3535

3636
## Benchmarks
3737

38-
Time taken to execute the [benchmark suite] (lower is better):
38+
Time taken to execute the [benchmark suite](https://github.com/ajeetdsouza/loxcraft/tree/main/res/benchmarks) (lower is better):
3939

4040
| Benchmark | loxcraft | clox | jlox |
4141
| ----------------- | -------- | ------ | ------- |
@@ -52,7 +52,7 @@ Time taken to execute the [benchmark suite] (lower is better):
5252
| trees | 9.97s | 8.72s | 72.87s |
5353
| zoo | 10.67s | 6.18s | 100.10s |
5454

55-
![Benchmarks]
55+
![Benchmarks](https://user-images.githubusercontent.com/1777663/216903842-5d626770-e599-491e-8e09-83b2f956cf34.svg)
5656

5757
Benchmarks were run with the following configuration:
5858

@@ -64,20 +64,20 @@ Benchmarks were run with the following configuration:
6464
- Apple Clang: 14.0.0
6565
- Oracle JDK: 19.0.2
6666

67+
## References
68+
69+
So you want to build your own programming language! Here's some extremely helpful resources I referred to when building `loxcraft`:
70+
71+
- [Crafting Interpreters](https://craftinginterpreters.com/) by Bob Nystrom: this book introduces you to a teaching programming language named Lox, walks you through implementing a full-featured tree walking interpreter for in in Java, and then shows you how to build a bytecode compiler + VM for it in C. I cannot recommend this book enough.
72+
- Bob Nystrom also has a [blog](https://journal.stuffwithstuff.com/), and his articles are really well written (see his post on [Pratt parsers](https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/) / [garbage collectors](https://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/)). I'd also recommend going through the source code for [Wren](https://wren.io/), it shares a lot of code with Lox. Despite the deceptive simplicity of the implementation, it (like Lox) is incredibly fast - it's a great way to learn how to build production grade compilers in general.
73+
- [Writing an Interpreter in Go](https://interpreterbook.com/) / [Writing a Compiler in Go](https://compilerbook.com/) by Thorsten Ball is a great set of books. Since it uses Go, it piggybacks on Go's garbage collector instead of building one of its own. This simplifies the implementation, making this book a lot easier to grok - but it also means that you may have trouble porting it to a non-GC language (like Rust).
74+
- [Make a Language](https://lunacookies.github.io/lang/) by Luna Razzaghipour is a fantastic series. Notably, this book constructs its syntax tree using the same library used by [rust-analyzer](https://rust-analyzer.github.io/) ([rowan](https://github.com/rust-analyzer/rowan)).
75+
- [Simple but Powerful Pratt Parsing](https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html) by Alex Kladov (one of the main authors behind rust-analyzer) is a great tutorial on building a parser in Rust. The rest of his blog is incredible too!
76+
- [rust-langdev](https://github.com/Kixiron/rust-langdev) has a lot of libraries for building compilers in Rust. To start off, I'd suggest [logos](https://github.com/maciejhirsz/logos) for lexing, [LALRPOP](https://lalrpop.github.io/lalrpop/) / [chumsky](https://github.com/zesterer/chumsky) for parsing, and [rust-gc](https://github.com/Manishearth/rust-gc) for garbage collection.
77+
- [Learning Rust with Entirely Too Many Linked Lists](https://rust-unofficial.github.io/too-many-lists/) is a quick tutorial on unsafe Rust, which you'll need if you're building a garbage collector yourself.
78+
- If you want some inspiration for a production-grade language built in Rust, you might want to go through the source code of [Starlark](https://github.com/facebook/starlark-rust) and [Gluon](https://github.com/gluon-lang/gluon).
79+
6780
## Contributors
6881

69-
- [Ajeet D'Souza][ajeetdsouza]
70-
- [Kartik Sharma][crazystylus]
71-
72-
[ajeetdsouza]: https://github.com/ajeetdsouza
73-
[benchmark suite]: https://github.com/ajeetdsouza/loxcraft/tree/main/res/benchmarks
74-
[benchmarks]: https://user-images.githubusercontent.com/1777663/216903842-5d626770-e599-491e-8e09-83b2f956cf34.svg
75-
[crates.io-badge]: https://img.shields.io/crates/v/loxcraft
76-
[crates.io]: https://crates.io/crates/loxcraft
77-
[crazystylus]: https://github.com/crazystylus
78-
[language server protocol]: https://microsoft.github.io/language-server-protocol/
79-
[lox playground]: https://ajeetdsouza.github.io/loxcraft/
80-
[lox programming language]: http://craftinginterpreters.com/
81-
[screenshot of online playground]: https://user-images.githubusercontent.com/1777663/201918922-39b567fe-9375-4990-8224-e540cf3266bc.png
82-
[screenshot of repl]: https://user-images.githubusercontent.com/1777663/216910834-4ea40427-34d7-43e0-8ba0-06638dfb0fa2.png
83-
[tree-sitter-lox]: https://github.com/ajeetdsouza/tree-sitter-lox
82+
- [Ajeet D'Souza](https://github.com/ajeetdsouza)
83+
- [Kartik Sharma](https://github.com/crazystylus)

0 commit comments

Comments
 (0)