parser

package
v0.0.0-...-5abede8 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Lowest = iota + 1
	Equals
	LessGreater
	Sum
	Product
	Prefix
	Call
	Index
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser repeatedly calls lexer's NextToken to apply logic onto it. We need the current and the next token for every evaluation, because future knowledge is crucial during evaluation. E.g: currentToken is 6 nextToken could be a semi-colon or the beginning of an arithmetic operation

func NewParser

func NewParser(lxr *lexer.Lexer) *Parser

NewParser is the constructor for the Parser type

func (*Parser) GetErrors

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

GetErrors returns the encountered errors of the parser

func (*Parser) ParseProgram

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

ParseProgram performs recursive descent parsing (aka Pratt parsing)

Jump to

Keyboard shortcuts

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