parser

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package parser builds an ast from tokens.

It is a hand-written recursive-descent parser with precedence climbing for expressions. It must recover from errors (skip to the next statement or closing brace) so that it can report several errors at once and still produce a tree: the LSP depends on this.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(src *diag.Source) (*ast.File, diag.List)

Parse lexes and parses a source file. It always returns a tree, with Bad nodes where there were syntax errors, and all lexer and parser errors.

func Prelude

func Prelude() []ast.Decl

Prelude returns the built-in declarations, such as the Error class. The checker and the interpreter add them to every program.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL