Skip to main content

Crate wolf_parser

Crate wolf_parser 

Source
Expand description

The wolfpack parser: tokens to a syntax tree (spec chapters 2 and 3).

Recursive descent for declarations and statements, a Pratt parser for expressions. The parser checks the file skeleton (chapter 2) while it reads the sections. It never stops at an error: it reports the problem, skips to a safe point (the end of the line or a closing delimiter) and continues, so that all errors of a file are shown at once. It never panics, and a nesting limit (E0314) keeps deep input from overflowing the stack.

Structs§

Parsed
The result of parsing one file.

Constants§

MAX_DEPTH
The deepest nesting of expressions, statements, types and patterns the parser accepts.
STACK_SIZE
The stack size needed to parse, print and drop a tree nested up to MAX_DEPTH in a debug build, with a wide margin. The wolf binary runs the compiler on a thread of this size; other users of the parser should do the same.

Functions§

parse
Parses the tokens of one file, as produced by wolf_lexer::lex.