百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

loxcraft

> 设计协作
开源

Lox 编程语言的语言工具。

365 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Lox 编程语言的语言工具。

Installation

bash
cargo install loxcraft --locked

Features

  • Bytecode compiler + garbage collected runtime
  • Online playground, via WebAssembly (try it out!)
  • REPL
  • Syntax highlighting, via tree-sitter-lox
  • IDE integration, via the Language Server Protocol

Screenshots

Benchmarks

Time taken to execute the benchmark suite (lower is better):

Benchmark loxcraft clox jlox
binary_tree 8.29s 8.13s 26.41s
equality_1 7.17s 7.73s 10.01s
equality_2 8.39s 9.66s 14.30s
fib 10.90s 10.09s 21.89s
instantiation 10.83s 12.84s 14.24s
invocation 9.93s 8.93s 15.77s
method_call 11.01s 9.12s 62.03s
properties 10.05s 5.98s 69.77s
string_equality_1 7.76s 7.66s 34.08s
string_equality_2 10.78s 10.52s 36.25s
trees 9.97s 8.72s 72.87s
zoo 10.67s 6.18s 100.10s

Benchmarks were run with the following configuration:

  • Device: Apple MacBook Pro (16-inch, 2021)
  • Processor: M1 Pro
  • RAM: 16 GiB
  • OS: macOS Ventura 13.2
  • Rust: 1.66.1
  • Apple Clang: 14.0.0
  • Oracle JDK: 19.0.2

References

So you want to build your own programming language! Here's some extremely helpful resources I referred to when building loxcraft:

  • Crafting Interpreters 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.
  • Bob Nystrom also has a blog, and his articles are really well written (see his post on Pratt parsers / garbage collectors). I'd also recommend going through the source code for Wren, 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.
  • Writing an Interpreter in Go / Writing a Compiler in Go 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).
  • Make a Language by Luna Razzaghipour is a fantastic series. Notably, this book constructs its syntax tree using the same library used by rust-analyzer (rowan).
  • Simple but Powerful Pratt Parsing 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!
  • rust-langdev has a lot of libraries for building compilers in Rust. To start off, I'd suggest logos for lexing, LALRPOP / chumsky for parsing, and rust-gc for garbage collection.
  • Learning Rust with Entirely Too Many Linked Lists is a quick tutorial on unsafe Rust, which you'll need if you're building a garbage collector yourself.
  • If you want some inspiration for a production-grade language built in Rust, you might want to go through the source code of Starlark and Gluon.

Contributors

  • Ajeet D'Souza
  • Kartik Sharma

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustbytecodebytecode-interpretercompilercompiler-construction

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类设计协作
定价开源

> 相关工具

F
Figma
协作式界面设计工具
S
sketch-wakatime
Sketch plugin for automatic time tracking and metrics generated from your Sketch usage.
Q
QuickColor
Quickly apply fills from the global or document color palettes to selected elements - 🎨