parser

package
v0.0.0-...-6ec744d Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LOWEST - The lowest precedence an expression can take
	LOWEST int
	// EQUALS - ==
	EQUALS
	// COMPARE - < or >
	COMPARE
	// SUM - a + b
	SUM
	// PRODUCT - a * b
	PRODUCT
	// BITWISE - <<, >>, &, |, ^
	BITWISE
	// LOGIC - &&, ||
	LOGIC
	// PREFIX - -x or !x
	PREFIX
	// DOT - a dot expression
	DOT
	// CALL - a function call
	CALL
	// INDEX - an array or map index
	INDEX
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Err

type Err struct {
	Msg string
	Con lexer.Context
}

Err represents the error that can be thrown by the parser

func (Err) Error

func (e Err) Error() string

type Parser

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

Parser - represents the parser for Monkey

func New

func New(l *lexer.Lexer) (*Parser, error)

New - returns a new Parser

func (*Parser) CheckErrors

func (p *Parser) CheckErrors() []error

CheckErrors returns all the errors found while parsing

func (*Parser) Parse

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

Parse - parses a stream of tokens

Jump to

Keyboard shortcuts

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