5 releases (3 breaking)
new 0.4.0 | Sep 10, 2024 |
---|---|
0.3.0 | Sep 9, 2024 |
0.2.0 | Sep 9, 2024 |
0.1.1 | Sep 9, 2024 |
0.1.0 | Sep 8, 2024 |
#594 in Parser implementations
709 downloads per month
Used in lua_semantics
390KB
11K
SLoC
lua_rust
lua syntax parser in Rust
- Greatly in progress
- LALR(1), GLR parser
- syntax referenced from lua 5.4 reference manual
project structure
tokenizer
: tokenizing lua code stringparser
: parsing tokenized lua code into ASTexec
: executable version of theparser
Cargo Features
32bit
: use 32bit integer and float forlua numeric
typediag
: enableto_diag()
function forParseError
how to run
$ cargo run <source_file.lua>
will print the pretty-formatted Debug
output of the AST ( "{:#?}"
)
lib.rs
:
let source = " <lua source code> ";
let block = match lua_parser::parse_str(&source) {
Ok(block) => block,
Err(err) => {
println!("{}", err);
return;
}
};
println!("AST:\n{:#?}", block);
Dependencies
~1–7.5MB
~50K SLoC