Syntax.Parse
The public Prism-owned parser.
The compiler remains the bootstrap oracle, but this module is a complete value-passing entry seam: source text is lexed and laid out by the Prism frontend, then declarations and expressions consume that exact post-layout token stream without calling back into Rust.
Types
ParseFailure
type ParseFailure
= ParseLex(LexError)
| ParseSyntax(Diagnostic)
deriving (Eq, Show)
A source-level parse failure, preserving whether lexing or parsing refused the input.
Functions and Values
parse_program_tokens
parse_program_tokens : (List(Syntax.Token.Token), Int) -> Result(List(Syntax.Ast.Item), Syntax.Diagnostic.Diagnostic)
Parse an already-laid-out whole-program token stream.
parse_source
parse_source : (String) -> Result(List(Syntax.Ast.Item), Syntax.Parse.ParseFailure)
Lex, lay out, and parse one complete Prism source file.
parse_source_budgeted
parse_source_budgeted : (Int, String) -> Result(List(Syntax.Ast.Item), Syntax.Parse.ParseFailure)
parse_source under an explicit recursion budget. The default budget is deep enough that no realistic program meets it; a harness probing the depth contract (acceptance below the budget, the structured refusal beyond it) passes a small budget here instead of paying for thousands of nesting levels. The refusal machinery exercised is identical at every budget.
parse_expr_tokens
parse_expr_tokens : (List(Syntax.Token.Token), Int) -> Result(Syntax.Ast.Sp(Syntax.Ast.Expr), Syntax.Diagnostic.Diagnostic)
Parse one expression from a token cursor and require complete consumption.
parse_expr_source
parse_expr_source : (String) -> Result(Syntax.Ast.Sp(Syntax.Ast.Expr), Syntax.Parse.ParseFailure)
Lex, lay out, and parse a standalone expression. Layout wraps a complete input in its top-level virtual block, so the expression entry removes that envelope before requiring the stream end.