#lua-parser #glr #lua #parser

lua_semantics

semantic analysis and enhanced AST converter for lua_parser crate

8 breaking releases

0.9.0 Jul 22, 2025
0.8.0 Oct 25, 2024
0.7.0 Oct 24, 2024

#1730 in Parser implementations

Download history 10/week @ 2025-09-29 1/week @ 2025-10-06 1/week @ 2025-10-13 1/week @ 2025-10-20

540 downloads per month
Used in lua_ir

MIT/Apache

1MB
27K SLoC

lua_rust

crates.io docs.rs

lua syntax parser & runtime interpreter in Rust

  • LALR(1), GLR parser with RustyLR
  • 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 for lua numeric type

How to use

As REPL interpreter

clone this repository and simply run

$ cargo run <source_file.lua>

or

$ cargo run

will start lua REPL. Note that this executable is not cargo published.

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() )?;

Dependencies

~0.4–2.7MB
~50K SLoC