← index

[Lang]Parser

inherits Object

The Quoin parser, exposed: parse: answers the program's [Lang]Node tree — the same AST the compiler consumes, wrapped, never copied. Unparseable source throws the same catchable ParseError Runtime.eval: throws. parse:named: labels the unit, and the name rides every node's file (diagnostics built from the tree point somewhere real). See [Lang]Node, and qnlib/lang/ast.qn for the traversal vocabulary and the span-based [Lang]Rewrite.

Class methods

parse:String

Parse Quoin source into its [Lang]Node tree (the root is kind #program); unparseable source throws a catchable ParseError. Nodes' file reads '<string>' — use parse:named: to label the unit.

native

parse:String named:String

parse:, with the unit named: every node's file answers name, so tooling built on the tree reports real locations.

native

parseFile:

Parse the file at path; its nodes' file answer the path.

lang/ast.qn:17