parser

package
v0.0.0-...-1e7c8b3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package parser is the package which parses our input.

Given a lexer, wrapping a given input-file, we parse tokens from it into a series of statements which we then return for processing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	// Our tokenizer.
	Tokenizer tokenizer
}

Parser holds our internal state.

func New

func New(tk tokenizer) *Parser

New returns a new Parser object, consuming tokens from the specified tokenizer-interface.

func (*Parser) GetArguments

func (p *Parser) GetArguments(expected []token.Token) ([]token.Token, error)

GetArguments fetches arguments from the lexer, ensuring they're the expected types.

func (*Parser) Parse

func (p *Parser) Parse() ([]statement.Statement, error)

Parse the given program, catching errors.

Jump to

Keyboard shortcuts

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