Documentation
¶
Overview ¶
Package parser contains the definition of the parser element of the glif interpreter.
If also declare the following:
- Precedence constants
- map of token/precedence
- prefix and infix functions
- parsing method for recognize tokens
Index ¶
Constants ¶
View Source
const ( LOWEST int TO // -> EQUALS // == LESSGREATER // < or > SUM // + PRODUCT // * PREFIX // -X or !X CALL // myFunction(X) INDEX // array[index] )
Contant used in the precedence parsing for operator
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is the representation of the glif parser It contains the following:
- A slice of errors (parsing error)
- The current token AND the next (peek) token
- Maps containing the prefix AND infix parse functions
func NewWithOptions ¶
NewWithOptions creates a new parser from a lexer and additionnal bool options The creation of the parser is done via the New function and not directly here, that way there is only one place where the parser is instantiated.
func (*Parser) ParseProgram ¶
ParseProgram is the entry point of the parser. It returns the *ast.Program node which represents the entire script.
Click to show internal directories.
Click to hide internal directories.