5 releases (3 breaking)
0.4.0 | Oct 25, 2024 |
---|---|
0.3.0 | Oct 21, 2024 |
0.2.0 | Oct 2, 2024 |
0.1.1 | Sep 30, 2024 |
0.1.0 | Sep 8, 2024 |
#739 in Parser implementations
345 downloads per month
Used in 3 crates
(2 directly)
83KB
2K
SLoC
lua_rust
lua syntax parser & runtime interpreter in Rust
- LALR(1), GLR parser
- syntax referenced from lua 5.4 reference manual
- Greatly in progress
- grammar fully implemented
- std library barely implemented
Cargo Features
32bit
: use 32bit integer and float forlua numeric
type
How to use
As library, add lua_ir
crate to your Cargo.toml
[dependencies]
lua_ir = "..."
let mut env = lua_ir::LuaEnv::new();
env.eval_chunk( b"var_hello = 'Hello'" )?;
env.eval_chunk( b"var_world = 'World'" )?;
env.eval_chunk( b"print( var_hello .. ', ' .. var_world .. '!' )" )?;
// Hello, World!
let hello_value = env.get_global( "var_hello" )?;
let world_value = env.get_global( "var_world" )?;
env.set_global( "var_hello", 10.into() )?;
Simply running
$ cargo run <source_file.lua>
or
$ cargo run
will start lua REPL. Note that this executable is not cargo publish
ed.
Dependencies
~0–6.5MB
~40K SLoC