Documentation ¶
Index ¶
- func IsExpr(n Node) bool
- func IsStatement(n Node) bool
- func NewLexError(pos scanner.Position, msg string) error
- func NewParseError(tok Token, msg string) error
- func NewSemanticError(node Node, msg string) error
- type ArrayAccessNode
- type BinaryNode
- type BlockNode
- type BreakNode
- type CaseNode
- type CharacterNode
- type ExternVarDeclNode
- type ExternVarInitNode
- type ExternVecInitNode
- type FunctionCallNode
- type FunctionNode
- type GotoNode
- type IdentNode
- type IfNode
- type IntegerNode
- type LabelNode
- type LexError
- type Lexer
- type Node
- type NullNode
- type OperatorBinding
- type ParenNode
- type ParseError
- type Parser
- type ReturnNode
- type SemanticError
- type StatementNode
- type StringNode
- type SwitchNode
- type TernaryNode
- type Token
- type TokenType
- type TranslationUnit
- func (t TranslationUnit) ResolveDuplicates() error
- func (t TranslationUnit) ResolveLabels(fn FunctionNode) error
- func (t TranslationUnit) String() string
- func (t TranslationUnit) Verify() error
- func (t TranslationUnit) VerifyAssignments(fn FunctionNode) error
- func (t TranslationUnit) VerifyFunction(fn FunctionNode) error
- type UnaryNode
- type VarDecl
- type VarDeclNode
- type WhileNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStatement ¶
func NewParseError ¶
func NewSemanticError ¶
Types ¶
type ArrayAccessNode ¶
func (ArrayAccessNode) String ¶
func (a ArrayAccessNode) String() string
type BinaryNode ¶
func (BinaryNode) String ¶
func (b BinaryNode) String() string
func (BinaryNode) StringWithPrecedence ¶
func (b BinaryNode) StringWithPrecedence() string
Use parens to make precedence more apparent
type CharacterNode ¶
type CharacterNode struct {
// contains filtered or unexported fields
}
func (CharacterNode) String ¶
func (c CharacterNode) String() string
type ExternVarDeclNode ¶
type ExternVarDeclNode struct {
// contains filtered or unexported fields
}
func (ExternVarDeclNode) String ¶
func (e ExternVarDeclNode) String() string
type ExternVarInitNode ¶
name value ';'
func (ExternVarInitNode) String ¶
func (e ExternVarInitNode) String() string
type ExternVecInitNode ¶
name '[' size ']' value+ ';'
func (ExternVecInitNode) String ¶
func (e ExternVecInitNode) String() string
type FunctionCallNode ¶
func (FunctionCallNode) String ¶
func (f FunctionCallNode) String() string
type FunctionNode ¶
name '(' (var (',' var)*) ? ')' block
func (FunctionNode) String ¶
func (f FunctionNode) String() string
type IntegerNode ¶
type IntegerNode struct {
Value int
}
func (IntegerNode) String ¶
func (i IntegerNode) String() string
type OperatorBinding ¶
type OperatorBinding int
func OperatorPrecedence ¶
func OperatorPrecedence(op string) (prec int, bind OperatorBinding)
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (*ParseError) Error ¶
func (p *ParseError) Error() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) Parse ¶
func (p *Parser) Parse() (unit TranslationUnit, err error)
type ReturnNode ¶
type ReturnNode struct{ Node Node }
func (ReturnNode) String ¶
func (r ReturnNode) String() string
type SemanticError ¶
type SemanticError struct {
// contains filtered or unexported fields
}
func (*SemanticError) Error ¶
func (s *SemanticError) Error() string
type StatementNode ¶
type StatementNode struct {
Expr Node
}
func (StatementNode) String ¶
func (s StatementNode) String() string
type StringNode ¶
type StringNode struct {
Value string
}
func (StringNode) String ¶
func (s StringNode) String() string
type SwitchNode ¶
func (SwitchNode) String ¶
func (s SwitchNode) String() string
type TernaryNode ¶
Yes, I know "ternary" is no more descriptive than binary op, but there's only one.
func (TernaryNode) String ¶
func (t TernaryNode) String() string
type TranslationUnit ¶
type TranslationUnit struct { File string Funcs []FunctionNode Vars []Node }
func (TranslationUnit) ResolveDuplicates ¶
func (t TranslationUnit) ResolveDuplicates() error
TODO: resolve auto variable declarations within function definitions
func (TranslationUnit) ResolveLabels ¶
func (t TranslationUnit) ResolveLabels(fn FunctionNode) error
Make sure all goto jump to valid places
func (TranslationUnit) String ¶
func (t TranslationUnit) String() string
func (TranslationUnit) Verify ¶
func (t TranslationUnit) Verify() error
func (TranslationUnit) VerifyAssignments ¶
func (t TranslationUnit) VerifyAssignments(fn FunctionNode) error
Verify that all assignments have a proper LHS and RHS
func (TranslationUnit) VerifyFunction ¶
func (t TranslationUnit) VerifyFunction(fn FunctionNode) error
type VarDeclNode ¶
type VarDeclNode struct {
Vars []VarDecl
}
func (VarDeclNode) String ¶
func (v VarDeclNode) String() string
Click to show internal directories.
Click to hide internal directories.