Documentation
¶
Index ¶
- type Argument
- type BlockStatement
- type CharLiteral
- type Expression
- type ExpressionStatement
- type FloatLiteral
- type Function
- func (f *Function) GetSymbol(name string) *Symbol
- func (f *Function) GetVariableCounts() (integerCount, floatCount int)
- func (f *Function) SetSymbol(name string, t ValueType, constant bool) *Symbol
- func (f *Function) String() string
- func (f *Function) TokenLiteral() string
- func (f *Function) ValueType() ValueType
- type FunctionCallExpression
- type Identifier
- type IfStatement
- type InfixExpression
- type IntegerLiteral
- type Node
- type PostfixExpression
- type PrefixExpression
- type Program
- type ReturnStatement
- type Statement
- type Symbol
- type ValueType
- type VariableDefineStatement
- type VariableUpdateStatement
- type WhileLoopStatement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockStatement ¶
func (*BlockStatement) String ¶
func (bs *BlockStatement) String() string
func (*BlockStatement) TokenLiteral ¶
func (bs *BlockStatement) TokenLiteral() string
func (*BlockStatement) ValueType ¶
func (bs *BlockStatement) ValueType() ValueType
type CharLiteral ¶
func (*CharLiteral) String ¶
func (cl *CharLiteral) String() string
func (*CharLiteral) TokenLiteral ¶
func (cl *CharLiteral) TokenLiteral() string
func (*CharLiteral) ValueType ¶
func (fl *CharLiteral) ValueType() ValueType
type Expression ¶
type Expression interface {
Node
// contains filtered or unexported methods
}
type ExpressionStatement ¶
type ExpressionStatement struct {
Token lexer.Token
Expression Expression
}
func (*ExpressionStatement) String ¶
func (es *ExpressionStatement) String() string
func (*ExpressionStatement) TokenLiteral ¶
func (es *ExpressionStatement) TokenLiteral() string
func (*ExpressionStatement) ValueType ¶
func (es *ExpressionStatement) ValueType() ValueType
type FloatLiteral ¶
func (*FloatLiteral) String ¶
func (fl *FloatLiteral) String() string
func (*FloatLiteral) TokenLiteral ¶
func (fl *FloatLiteral) TokenLiteral() string
func (*FloatLiteral) ValueType ¶
func (fl *FloatLiteral) ValueType() ValueType
type Function ¶
type Function struct {
Name string
ReturnType ValueType
Statement Statement
SymbolIndex map[string]int
Symbols []*Symbol
NextSymbolIndex int
Arguments []Argument
}
func NewFunction ¶
func (*Function) GetVariableCounts ¶
func (*Function) TokenLiteral ¶
type FunctionCallExpression ¶
type FunctionCallExpression struct {
Token lexer.Token
Name string
Args []Expression
ReturnType ValueType
Index int
}
func (*FunctionCallExpression) String ¶
func (fce *FunctionCallExpression) String() string
func (*FunctionCallExpression) TokenLiteral ¶
func (fce *FunctionCallExpression) TokenLiteral() string
func (*FunctionCallExpression) ValueType ¶
func (fce *FunctionCallExpression) ValueType() ValueType
type Identifier ¶
func (*Identifier) String ¶
func (i *Identifier) String() string
func (*Identifier) TokenLiteral ¶
func (i *Identifier) TokenLiteral() string
func (*Identifier) ValueType ¶
func (i *Identifier) ValueType() ValueType
type IfStatement ¶
type IfStatement struct {
Token lexer.Token
Condition Expression
Consequence Statement
Alternative Statement
}
func (*IfStatement) String ¶
func (i *IfStatement) String() string
func (*IfStatement) TokenLiteral ¶
func (i *IfStatement) TokenLiteral() string
func (*IfStatement) ValueType ¶
func (i *IfStatement) ValueType() ValueType
type InfixExpression ¶
type InfixExpression struct {
Token lexer.Token
Left Expression
Operator string
Right Expression
}
func (*InfixExpression) String ¶
func (ie *InfixExpression) String() string
func (*InfixExpression) TokenLiteral ¶
func (ie *InfixExpression) TokenLiteral() string
func (*InfixExpression) ValueType ¶
func (ie *InfixExpression) ValueType() ValueType
type IntegerLiteral ¶
func (*IntegerLiteral) String ¶
func (il *IntegerLiteral) String() string
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
func (*IntegerLiteral) ValueType ¶
func (il *IntegerLiteral) ValueType() ValueType
type PostfixExpression ¶
type PostfixExpression struct {
Token lexer.Token
Left Expression
Operator string
}
func (*PostfixExpression) String ¶
func (pe *PostfixExpression) String() string
func (*PostfixExpression) TokenLiteral ¶
func (pe *PostfixExpression) TokenLiteral() string
func (*PostfixExpression) ValueType ¶
func (pe *PostfixExpression) ValueType() ValueType
type PrefixExpression ¶
type PrefixExpression struct {
Token lexer.Token
Operator string
Right Expression
}
func (*PrefixExpression) String ¶
func (pe *PrefixExpression) String() string
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
func (*PrefixExpression) ValueType ¶
func (pe *PrefixExpression) ValueType() ValueType
type Program ¶
type Program struct {
Functions []*Function
// Functions to be imported from JS
ExternalFunctions []*Function
// global statements
Statements []Statement
}
func (*Program) FunctionExists ¶
checks if a function exists, if so returns it's index. otherwise the function returns -1
func (*Program) TokenLiteral ¶
type ReturnStatement ¶
type ReturnStatement struct {
Token lexer.Token
ReturnValue Expression
}
func (*ReturnStatement) String ¶
func (rs *ReturnStatement) String() string
func (*ReturnStatement) TokenLiteral ¶
func (rs *ReturnStatement) TokenLiteral() string
func (*ReturnStatement) ValueType ¶
func (rs *ReturnStatement) ValueType() ValueType
type VariableDefineStatement ¶
type VariableDefineStatement struct {
Token lexer.Token
Name *Identifier
Value Expression
Type ValueType
}
func (*VariableDefineStatement) String ¶
func (vds *VariableDefineStatement) String() string
func (*VariableDefineStatement) TokenLiteral ¶
func (vds *VariableDefineStatement) TokenLiteral() string
func (*VariableDefineStatement) ValueType ¶
func (vds *VariableDefineStatement) ValueType() ValueType
type VariableUpdateStatement ¶
type VariableUpdateStatement struct {
Name *Identifier
Token lexer.Token
NewValue Expression
Operation string
}
func (*VariableUpdateStatement) String ¶
func (vus *VariableUpdateStatement) String() string
func (*VariableUpdateStatement) TokenLiteral ¶
func (vus *VariableUpdateStatement) TokenLiteral() string
func (*VariableUpdateStatement) ValueType ¶
func (vus *VariableUpdateStatement) ValueType() ValueType
type WhileLoopStatement ¶
type WhileLoopStatement struct {
Token lexer.Token
Condition Expression
Statement Statement
}
func (*WhileLoopStatement) String ¶
func (ws *WhileLoopStatement) String() string
func (*WhileLoopStatement) TokenLiteral ¶
func (ws *WhileLoopStatement) TokenLiteral() string
func (*WhileLoopStatement) ValueType ¶
func (ws *WhileLoopStatement) ValueType() ValueType
Click to show internal directories.
Click to hide internal directories.