parser

package
v0.0.0-...-eb82b58 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package parser is used to parse input-programs written in monkey and convert them to an abstract-syntax tree.

Index

Constants

View Source
const (
	LOWEST       int
	COND         // OR or AND
	ASSIGN       // =
	TERNARY      // ? :
	EQUALS       // == or !=
	REGEXP_MATCH // !~ ~=
	LESSGREATER  // > or <
	SUM          // + or -
	PRODUCT      // * or /
	POWER        // **
	MOD          // %
	PREFIX       // -X or !X
	CALL         // myFunction(X)
	DOTDOT       // ..
	INDEX        // array[index], map[key]
	HIGHEST
)

precedence order

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser object

func New

func New(l *lexer.Lexer) *Parser

New returns our new parser-object.

func (*Parser) Errors

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

Errors return stored errors

func (*Parser) ParseProgram

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

ParseProgram used to parse the whole program

Jump to

Keyboard shortcuts

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