Skip to main content

Module parser

Module parser 

Source
Expand description

The parser: tokens in, an ast out.

This is a hand-written recursive-descent parser. Each grammar rule is one method, and expression precedence is a ladder of methods from loosest (||) to tightest (unary !/-). Hand-rolling keeps the whole frontend legible — you can read exactly how lux understands a program, which is the point of a language built to be learned from.

Functions§

parse
Parse a full program into a list of statements.