yul-parser

Crates.ioyul-parser
lib.rsyul-parser
version0.1.1
sourcesrc
created_at2022-05-22 14:53:16.908221
updated_at2022-05-22 14:53:16.908221
descriptionYul language parser
homepage
repositoryhttps://github.com/recmo/yul
max_upload_size
id591166
size309,239
Remco Bloemen (recmo)

documentation

README

Yul parser

Parses the Yul programming language. See the yul specification.

The parser uses [Logos][https://docs.rs/logos/latest/logos] for tokenization and [Rowan][https://docs.rs/rowan/latest/rowan] for a parsing. The tokens (aka lexer) are defined in the [token.rs][./src/tokens.rs] and the syntax (aka grammar) is defined in [syntax.rs][./src/syntax.rs].

The architecture is based on that of rust-analyzer. In fact, rowan is part of the rust-analyzer project. I recommend reading their write-up to understand rowan. Another great introduction is this tutorial by Luna Razzaghipour.

Specifically the architecture is for lossless parsing with good error recovery. This means that the original source file can always be perfectly reconstructed from the parse tree, even if it has errors. Comments, whitespace and parse errors are explicitly included in the parse tree.

Commit count: 7

cargo fmt