parser

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LOWEST == 1 default precedence
	LOWEST int
	// EQUALS == 2 precedence for operators [==,!=]
	EQUALS
	// LESSGREATER == 3 precedence for operators [>,<,>=,<=]
	LESSGREATER
	// SUM == 4 precedence for operators [+,"infixed" -]
	SUM
	// PRODUCT == 5 precedence for operators [*,/]
	PRODUCT
	// PREFIX == 6 precedence for operators ["prefixed" -,!]
	PREFIX
	// CALL == 7 precedence for operator (
	CALL
	// INDEX == 8 precedence for "[x]" opertor
	INDEX
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser structure represents the semantic analyzer.

func New

func New(l *lexer.Lexer) *Parser

New creates new Parser with given lexical analyzer object.

func (*Parser) Errors

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

Errors returns the errors that occurred during the semantic analysis.

func (*Parser) ParseProgram

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

ParseProgram starts the actual analysis of Lexer's program.

Jump to

Keyboard shortcuts

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