Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eatonphil/lust
A parser, compiler, and virtual machine evaluator for a minimal subset of Lua; written from scratch in Rust.
https://github.com/eatonphil/lust
compiler interpreter lua rust virtual-machine
Last synced: 3 months ago
JSON representation
A parser, compiler, and virtual machine evaluator for a minimal subset of Lua; written from scratch in Rust.
- Host: GitHub
- URL: https://github.com/eatonphil/lust
- Owner: eatonphil
- License: other
- Created: 2021-12-28T03:27:00.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-29T19:51:58.000Z (about 3 years ago)
- Last Synced: 2024-10-13T04:12:46.032Z (3 months ago)
- Topics: compiler, interpreter, lua, rust, virtual-machine
- Language: Rust
- Homepage:
- Size: 37.1 KB
- Stars: 188
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# lust: Lua in Rust
This project implements a parser, compiler, and virtual machine
evaluator for a minimal subset of Lua. It is written from scratch in
Rust.See the companion blog post, [Writing a minimal Lua implementation
with a virtual machine from scratch in Rust
](https://notes.eatonphil.com/lua-in-rust.html), for a guided
walkthrough of the code.## Example
```bash
$ cargo build --release
$ cat test/fib.lua
function fib(n)
if n < 2 then
return n;
endlocal n1 = fib(n-1);
local n2 = fib(n-2);
return n1 + n2;
endprint(fib(30));
$ time ./target/release/lust test/fib.lua
832040
./target/release/lust test/fib.lua 0.29s user 0.00s system 99% cpu 0.293 total
$ time lua test/fib.lua
832040
lua test/fib.lua 0.06s user 0.00s system 99% cpu 0.063 total
```## More examples
See the test directory.