Documentation
¶
Overview ¶
Package parser consumes tokens from the lexer and returns a program as a set of AST-nodes.
Later we walk the AST tree and generate a series of bytecode instructions.
Index ¶
Constants ¶
View Source
const ( LOWEST int ASSIGN // = COND // OR or AND EQUALS // == or != CMP LESSGREATER // > or < SUM // + or - PRODUCT // * or / POWER // ** MOD // % PREFIX // -X or !X CALL // myFunction(X) INDEX // array[index], map[key] )
Here we define values for precedence, lowest to highest.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is the object which maintains our parser state.
We consume tokens, produced by our lexer, and so we need to keep track of our current token, the next token, and any errors we've seen, for example.
func New ¶
New returns a new parser.
Once constructed it can be used to parse an input-program into an AST.
func (*Parser) ParseProgram ¶
ParseProgram used to parse the whole program
Click to show internal directories.
Click to hide internal directories.