Skip to main content

Module parse

Module parse 

Source
Expand description

Parse the lambda surface syntax into a locally nameless term (INV-626).

term ::= atom+                      -- application, left associative
atom ::= name | '"' text '"' | ("λ" | "\\") name "." term | "(" term ")"

A name bound by an enclosing abstraction becomes its de Bruijn index and any other name stays a free variable, so two sources that differ only in bound names parse to equal terms. A quoted string is a free variable whose name keeps its quotes. A position counts characters, not bytes, so it matches the Python and TypeScript cores on λ and other non-ASCII input.

Structs§

ParseFailure

Functions§

parse