LALR(1) parser generator that builds canonical LR(1) item sets
  • Scheme 98.2%
  • Makefile 1.8%
Find a file
emanon 70e2529cb9
Merge pull request #1 from vamp1nn/stuff
add lalr conflict provenance and ambiguity classification
2026-09-03 02:21:09 +00:00
bin initial commit 2026-02-03 09:00:00 +00:00
examples classify reduce reduce ambiguity sources 2026-09-03 10:30:00 +00:00
src add lr conflict provenance records 2026-09-02 13:30:00 +00:00
tests classify reduce reduce ambiguity sources 2026-09-03 10:30:00 +00:00
.gitignore initial commit 2026-02-03 09:00:00 +00:00
Makefile expand regression coverage for rich grammars 2026-09-03 02:00:32 +00:00
README.md expand regression coverage for rich grammars 2026-09-03 02:00:32 +00:00
VERSION add release version metadata 2026-02-05 15:00:00 +00:00

lolly

lolly is an LALR(1) parser generator that builds canonical LR(1) item sets then merges equivalent LR(0) cores before producing action and goto tables for a shift and reduce parser runtime

grammars use declarative data and semantic actions can construct an AST or return domain values while lexing remains outside the generator so applications can provide their own tokeniser and source location model

examples

Use the library directly from the source tree

(load "src/lolly.scm")
(define parser (lolly-parser (lolly-grammar-file "examples/arithmetic.scm")))
(lolly-parse parser
  (list (cons 'NUMBER 2)
        (cons 'PLUS #f)
        (cons 'NUMBER 3)))

Generate the larger recursive grammars with the command line interface

bin/lolly examples/json.scm build/json-parser.scm
bin/lolly examples/mini-language.scm build/mini-language-parser.scm

Run the regression checks with make check

todos

  • add conflict diagnostics with state and production information
  • add parser error locations and expected token reporting
  • improve grammar validation for undefined and unreachable symbols
  • add a documented lexer interface with source span support
  • split the implementation into a proper module
  • expand regression coverage for JSON and the mini language
  • add canonical LR(1) and LALR(1) table inspection commands