parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Lowest represents the lowest operator precedence
	Lowest int
	// Logical represents the logical AND and OR operators
	Logical
	// Equals represents the equals comparison operator
	Equals
	// LessGreater represents the LT, GT, LTE, and GTE operators
	LessGreater
	// Sum represents the addition operator
	Sum
	// Product represents the multiplication operator
	Product
	// Prefix represents prefix operators such as Minus or Bang
	Prefix
	// Call represents function calls
	Call
	// Index represents array indexes
	Index
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser represents the parser component of the interpreter

func New

func New(l *lexer.Lexer) *Parser

New creates a new parser instance and registers the parser functions

func (*Parser) Errors

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

Errors returns any errors encountered during parsing

func (*Parser) ParseProgram

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

ParseProgram runs through all thr tokens and parses them as statements or expressions

Jump to

Keyboard shortcuts

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