parser

package
v0.0.0-...-43a95db Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LOWEST is the lowest precedence operator
	LOWEST int
	// EQUALS is ==
	EQUALS
	// LESSGREATER is > or <
	LESSGREATER
	// SUM is +
	SUM
	// PRODUCT is *
	PRODUCT
	// PREFIX is -x or !x
	PREFIX
	// CALL is myFn(x)
	CALL
	// INDEX is array[index]
	INDEX
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser contains the lexer and parses tokens one at a time, generating an AST

func New

func New(l *lexer.Lexer) *Parser

New creates a new Parser from a given lexer

func (*Parser) Errors

func (p *Parser) Errors() []string

Errors returns the list of parsing errors

func (*Parser) ParseProgram

func (p *Parser) ParseProgram() *ast.Program

ParseProgram generates an AST based on the tokens

Jump to

Keyboard shortcuts

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