parser

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package parser implements the parser and produces an AST from source code.

Index

Constants

View Source
const (
	LOWEST int
	OR
	AND
	NOT
	IN
	ASSIGN       // := or =
	EQUALS       // ==
	LESSGREATER  // > or <
	BitwiseOR    // |
	BitwiseXOR   // ^
	BitwiseAND   // &
	BitwiseShift // << or >>
	SUM          // + or -
	PRODUCT      // * / or %
	PREFIX       // -X or !X
	CALL         // myFunction(X)
	INDEX        // array[index]

)

Variables

This section is empty.

Functions

func Parse

func Parse(fn, input string) (prog ast.Node, errors []string)

Parse parses the input source into a top-level AST for either evaluation or compilation to bytecode. The parameter fn denotes the filename the source originated from.

Types

type Parser

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

func New

func New(fn string, l *lexer.Lexer) *Parser

func (*Parser) Errors

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

func (*Parser) ParseProgram

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳