Documentation ¶
Index ¶
- type Assignment
- type BinOp
- type Block
- type Branch
- type CompilerContext
- type ConditionalBranch
- type Constant
- type ConstantType
- type Expression
- type Function
- func (f *Function) AddBlock(b *Block)
- func (f *Function) AddLocal(name string, typ string, value string)
- func (f *Function) AddParam(name string, ownership string, t string)
- func (f *Function) GenIR(cc *CompilerContext) value.Value
- func (f *Function) GenIRForProtos(cc *CompilerContext) value.Value
- func (f *Function) String() string
- type FunctionCall
- type FunctionLocal
- type FunctionParam
- type FunctionProto
- type Instruction
- type Node
- type NumericLiteral
- type Package
- type Retrn
- type StringLiteral
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assignment ¶
type Assignment struct { VarName string Expr Expression }
func NewAssignment ¶
func NewAssignment(varName string, expr Expression) *Assignment
func (*Assignment) GenIR ¶
func (a *Assignment) GenIR(cc *CompilerContext) value.Value
func (*Assignment) String ¶
func (a *Assignment) String() string
type BinOp ¶
type BinOp struct { Left Expression Op string Right Expression }
func NewBinOp ¶
func NewBinOp(left Expression, op string, right Expression) *BinOp
type Block ¶
type Block struct { Name string Instructions []Instruction Terminator Instruction }
func (*Block) AddInstruction ¶
func (b *Block) AddInstruction(i Instruction)
type CompilerContext ¶
type CompilerContext struct {
// contains filtered or unexported fields
}
func NewCompilerContext ¶
func NewCompilerContext(mod *ir.Module) *CompilerContext
func (*CompilerContext) GetIRModule ¶
func (cc *CompilerContext) GetIRModule() *ir.Module
type ConditionalBranch ¶
func NewConditionalBranch ¶
func NewConditionalBranch(condition *BinOp, trueTarget *Block, falseTarget *Block) *ConditionalBranch
func (*ConditionalBranch) GenIR ¶
func (b *ConditionalBranch) GenIR(cc *CompilerContext) value.Value
func (*ConditionalBranch) String ¶
func (b *ConditionalBranch) String() string
type Constant ¶
type Constant struct { Value string T ConstantType }
func NewConstant ¶
func NewConstant(v string, t ConstantType) *Constant
type Expression ¶
type Expression interface { GenIR(cc *CompilerContext) value.Value String() string // contains filtered or unexported methods }
type Function ¶
type Function struct { Proto *FunctionProto Locals []*FunctionLocal Blocks []*Block // contains filtered or unexported fields }
func NewFunction ¶
func (*Function) GenIRForProtos ¶
func (f *Function) GenIRForProtos(cc *CompilerContext) value.Value
type FunctionCall ¶
type FunctionCall struct { ModuleName string FunctionName string Args []Expression }
func NewFunctionCall ¶
func NewFunctionCall(moduleName string, functionName string) *FunctionCall
func (*FunctionCall) AddArg ¶
func (fc *FunctionCall) AddArg(expr Expression)
func (*FunctionCall) GenIR ¶
func (fc *FunctionCall) GenIR(cc *CompilerContext) value.Value
func (*FunctionCall) String ¶
func (fc *FunctionCall) String() string
type FunctionLocal ¶
func (*FunctionLocal) GenIR ¶
func (fl *FunctionLocal) GenIR(cc *CompilerContext) value.Value
func (*FunctionLocal) String ¶
func (fl *FunctionLocal) String() string
type FunctionParam ¶
func (*FunctionParam) GenIR ¶
func (fp *FunctionParam) GenIR(cc *CompilerContext) *ir.Param
func (*FunctionParam) String ¶
func (fp *FunctionParam) String() string
type FunctionProto ¶
type FunctionProto struct { Name string Params []*FunctionParam }
func NewFunctionProto ¶
func NewFunctionProto(name string) *FunctionProto
func (*FunctionProto) AddParam ¶
func (fp *FunctionProto) AddParam(name string, ownership string, t string)
func (*FunctionProto) GenIR ¶
func (fp *FunctionProto) GenIR(cc *CompilerContext) *ir.Func
func (*FunctionProto) String ¶
func (fp *FunctionProto) String() string
type Instruction ¶
type Instruction interface { GenIR(cc *CompilerContext) value.Value String() string }
type NumericLiteral ¶
type NumericLiteral struct {
Value int64
}
func NewNumericLiteral ¶
func NewNumericLiteral(value string) *NumericLiteral
func (*NumericLiteral) GenIR ¶
func (nl *NumericLiteral) GenIR(cc *CompilerContext) value.Value
func (*NumericLiteral) String ¶
func (nl *NumericLiteral) String() string
type Package ¶
type Package struct { Name string // contains filtered or unexported fields }
func NewPackage ¶
func (*Package) AddFunction ¶
func (*Package) GenIR ¶
func (p *Package) GenIR(cc *CompilerContext) error
func (*Package) HasMainFunction ¶
type StringLiteral ¶
type StringLiteral struct {
Value string
}
func NewStringLiteral ¶
func NewStringLiteral(value string) *StringLiteral
func (*StringLiteral) GenIR ¶
func (sl *StringLiteral) GenIR(cc *CompilerContext) value.Value
func (*StringLiteral) String ¶
func (sl *StringLiteral) String() string
Click to show internal directories.
Click to hide internal directories.