Documentation ¶
Index ¶
- func NodeIsVariable(node Node) bool
- type BoolLit
- type DirectOperation
- type Eos
- type Expression
- type FreeStatement
- type Function
- type FunctionCall
- type IfStatement
- type Litteral
- type Node
- type NumLit
- type Operator
- type Parser
- type PlotStatement
- type PrintCall
- type SetStatement
- type StatVar
- type Statement
- type StringLit
- type SwitchCase
- type SwitchStatement
- type Symbol
- type Variable
- type VariableReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NodeIsVariable ¶
NodeIsVariable allows for nice statements like if NodeIsVariable(node) {}
Types ¶
type BoolLit ¶
type BoolLit struct {
Value string
}
BoolLit represents a boolean litteral being either "True" or "False"
func (BoolLit) GetNodeName ¶
type DirectOperation ¶
func (DirectOperation) GetNodeName ¶
func (do DirectOperation) GetNodeName() string
type Eos ¶
type Eos struct {
Body []Node
}
Eos is a special node in a switch statement that is called if defined when no cases match the given value
func (Eos) GetNodeName ¶
type Expression ¶
Expression contains nodes in RPN form
func (Expression) GetNodeName ¶
func (e Expression) GetNodeName() string
GetNodeName so its valid on the node interface and we can ask what type it is later
type FreeStatement ¶
type FreeStatement struct {
Variable Node
}
FreeStatement is an instruction that frees a variable from the stack
func (FreeStatement) GetNodeName ¶
func (r FreeStatement) GetNodeName() string
type Function ¶
Function is a standard function definition containing the name, parameters and body of the function
func (Function) GetNodeName ¶
type FunctionCall ¶
FunctionCall specifies a function call and the arguments given
func (FunctionCall) GetNodeName ¶
func (fc FunctionCall) GetNodeName() string
type IfStatement ¶
IfStatement is a conditional block that has an expression and a body
func (IfStatement) GetNodeName ¶
func (i IfStatement) GetNodeName() string
type Litteral ¶
type Litteral struct {
// contains filtered or unexported fields
}
Litteral is a node type for static values such as integers and string litterals
func CreateLitteral ¶
CreateLitteral creates a new Litteral struct
func (Litteral) GetNodeName ¶
GetNodeName is a generic function that allows subtypes of a node in the AST
type Node ¶
type Node interface {
GetNodeName() string //GetNodeName Gets the identifier of a AST node describing what it is
}
Node is a wrapper interface that AST nodes can implement
type NumLit ¶
type NumLit struct {
Value string
}
NumLit represents a numeric litteral.
func (NumLit) GetNodeName ¶
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
Operator is a symbol that operates on one or more sides
func (Operator) GetNodeName ¶
GetNodeName is a generic function that allows subtypes of a node in the AST
type Parser ¶
Parser contains the final AST and forms a base for all ast generating functions
type PlotStatement ¶
type PlotStatement struct {
X, Y Node
}
PlotStatement is a statement that contains all info needed to draw a pixel to the screen
func (PlotStatement) GetNodeName ¶
func (p PlotStatement) GetNodeName() string
type PrintCall ¶
type PrintCall struct {
Printable Node
}
PrintCall specifies a call to the inbuilt print function
func (PrintCall) GetNodeName ¶
type SetStatement ¶
SetStatement is used when a value needs to be set to a variable. Instructions that could make use of this are SET
func (SetStatement) GetNodeName ¶
func (ss SetStatement) GetNodeName() string
type StatVar ¶
type StatVar struct {
Value string
}
StatVar contains the value of a static variable. These statVars are used when a variable is being referenced where the Value is the name of the variable referenced
func (StatVar) GetNodeName ¶
type Statement ¶
Statement is a general statement container for all other statements that do not fall under math and logic for example MEM
func (Statement) GetNodeName ¶
type StringLit ¶
type StringLit struct {
Value string
}
StringLit represents a string litteral
func (StringLit) GetNodeName ¶
type SwitchCase ¶
SwitchCase is a block definiton that is run when the MatchValue is matched
func (SwitchCase) GetNodeName ¶
func (sc SwitchCase) GetNodeName() string
type SwitchStatement ¶
SwitchStatement matches the Matchcase against all cases defined in Cases of the switchcase if one matches, the body of that case will be executed. if a EOS is defined within the body, the EOS body will be run if no case matches the matchvalue
func (SwitchStatement) GetNodeName ¶
func (st SwitchStatement) GetNodeName() string
type Symbol ¶
type Symbol struct {
// contains filtered or unexported fields
}
Symbol is a character that is not and operator or a latin character / numeral
func CreateSymbol ¶
CreateSymbol takes a string and returns it wrapped in a node like
func (Symbol) GetNodeName ¶
GetNodeName is a generic function that allows subtypes of a node in the AST
type Variable ¶
type Variable struct { Name string Type string Value Node ValueExpression Expression }
Variable is a construct used to create a new variable. This is the struct that will be pushed to the stack
func (*Variable) GetAllocationType ¶
GetAllocationType determines if a type must be stack or heap allocated
func (Variable) GetNodeName ¶
type VariableReference ¶
type VariableReference struct {
// contains filtered or unexported fields
}
VariableReference contains the name of a referenced variable during AST generation
func (VariableReference) GetNodeName ¶
func (vr VariableReference) GetNodeName() string
GetNodeName so its valid on the node interface and we can ask what type it is later