|
Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
|
All dependencies are provided by nix develop if you use Nix.
Lime's parser generator is a single C file with no dependencies:
That's it. You now have a working parser generator.
Create expr.lime (the recommended extension; .y also works for compatibility with existing tooling, but .lime avoids confusion when a project has both Bison and Lime grammars side by side during a migration):
Generate the parser:
This produces expr.c and expr.h. The generated parser is a push-parser: you feed it tokens one at a time.
Create main.c:
Compile and run:
If you need runtime grammar extension, SIMD tokenization, or JIT:
This builds:
lime generatorliblime_parser.a — the extension framework library| Meson flag | Effect |
|---|---|
-Dllvm=auto (default) | Enable JIT if llvm-config is found, otherwise build stubs |
-Dllvm=enabled | Require LLVM; hard error at configure if absent |
-Dllvm=disabled | Never probe; build stubs only (no libLLVM in ldd) |
-Dllvm-static=true | Statically link LLVM into the binary (no runtime libLLVM.so dependency; binary grows by 50-80 MB) |
If multiple llvm-config binaries are on PATH (common on Linux distros that ship several LLVM versions side by side) set LLVM_CONFIG=/path/to/llvm-config before meson setup to pin the choice. The flake's devShell does this automatically.
| Flag | Description |
|---|---|
-d dir | Write output files to dir |
-T file | Use a custom parser template instead of limpar.c |
-s | Print parser statistics (states, rules, conflicts) |
-L | Lint: validate grammar without generating code |
-F | Format: rewrite grammar with consistent style |
-q | Quiet: don't generate the .out report file |
-l | Omit #line directives from generated code |
-x | Print version and exit |