lalrpop

LR(1) parser generator for Rust

Github星跟踪图

LALRPOP

Join the chat at https://gitter.im/lalrpop/Lobby

Build status

LALRPOP is a Rust parser generator framework with usability as its
primary goal. You should be able to write compact, DRY, readable
grammars. To this end, LALRPOP offers a number of nifty features:

  1. Nice error messages in case parser constructor fails.
  2. Macros that let you extract common parts of your grammar. This
    means you can go beyond simple repetition like Id* and define
    things like Comma<Id> for a comma-separated list of identifiers.
  3. Macros can also create subsets, so that you easily do something
    like Expr<"all"> to represent the full range of expressions, but
    Expr<"if"> to represent the subset of expressions that can appear
    in an if expression.
  4. Builtin support for operators like * and ?.
  5. Compact defaults so that you can avoid writing action code much of the
    time.
  6. Type inference so you can often omit the types of nonterminals.

Despite its name, LALRPOP in fact uses LR(1) by default (though you
can opt for LALR(1)), and really I hope to eventually move to
something general that can handle all CFGs (like GLL, GLR, LL(*),
etc).

Documentation

The LALRPOP book covers all things LALRPOP -- or at least it intends
to! Here are some tips:

  • The tutorial covers the basics of setting up a LALRPOP parser.
  • For the impatient, you may prefer the quick start guide section, which describes
    how to add LALRPOP to your Cargo.toml.
  • The advanced setup chapter shows how to configure other aspects of LALRPOP's
    preprocessing.
  • If you have any questions join our gitter lobby.

Example Uses

  • LALRPOP is itself implemented in LALRPOP.
  • Gluon is a statically typed functional programming language.
  • Gleam is a statically typed functional programming language for the Erlang VM.
  • RustPython is Python 3.5+ rewritten in Rust
  • Solang is Ethereum Solidity rewritten in Rust

Contributing

You really should read CONTRIBUTING.md if you intend to change LALRPOP's own grammar.

主要指标

概览
名称与所有者lalrpop/lalrpop
主编程语言Rust
编程语言Rust (语言数: 3)
平台
许可证Apache License 2.0
所有者活动
创建于2015-06-12 19:41:37
推送于2025-07-16 05:47:50
最后一次提交2025-07-15 22:47:20
发布数38
最新版本名称0.22.2 (发布于 2025-05-22 14:49:44)
第一版名称0.12.4 (发布于 )
用户参与
星数3.3k
关注者数32
派生数300
提交数1.6k
已启用问题?
问题数461
打开的问题数145
拉请求数510
打开的拉请求数18
关闭的拉请求数62
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?