Documentation ¶
Index ¶
- func NewLLBool(value bool) *constant.Int
- func NewLLFloat(bitSize uint64, value float64) *constant.Float
- func NewLLInt(bitSize uint64, value int) *constant.Int
- func NewLLTypeBool() *types.IntType
- func NewLLTypeFloat(bitSize uint64) *types.FloatType
- func NewLLTypeInt(bitSize uint64) *types.IntType
- func NewLLTypeVoid() *types.VoidType
- type AccessorOp
- type ArrayType
- type AssignStmt
- type BasicType
- type BinaryOp
- type Block
- func (b *Block) AddGlobal(v *Variable)
- func (b *Block) AddLocal(v *Variable) error
- func (b *Block) AddLocalType(alias string, typ *Type)
- func (b *Block) AddModuleTypeDef(alias string, typ *Type)
- func (b *Block) BasicBlock() *ir.Block
- func (b *Block) Current() *Scope
- func (b *Block) CurrentFunction() *Function
- func (b *Block) CurrentModule() *Module
- func (b *Block) FindFunction(ident string) *Function
- func (b *Block) FindTypeDefByAlias(alias string) *TypeDef
- func (b *Block) FindTypeDefByType(typ *Type) *TypeDef
- func (b *Block) FindVariable(ident string) *Variable
- func (b *Block) Generate() error
- func (b *Block) SetBasicBlock(bb *ir.Block)
- func (b *Block) String() []string
- type CastingOp
- type ConstantBoolOp
- type ConstantCharOp
- type ConstantNumberOp
- type ConstantStringOp
- type DeclStmt
- type ExprStmt
- type ExpressionLike
- type ExpressionLikeList
- type FnCallOp
- type Function
- func (f *Function) AddGlobal(v *Variable)
- func (f *Function) AddLocal(v *Variable) error
- func (f *Function) AddLocalType(alias string, typ *Type)
- func (f *Function) AddModuleTypeDef(alias string, typ *Type)
- func (f *Function) BasicBlock() *ir.Block
- func (f *Function) Current() *Scope
- func (f *Function) CurrentFunction() *Function
- func (f *Function) CurrentModule() *Module
- func (f *Function) FindFunction(ident string) *Function
- func (f *Function) FindTypeDefByAlias(alias string) *TypeDef
- func (f *Function) FindTypeDefByType(typ *Type) *TypeDef
- func (f *Function) FindVariable(ident string) *Variable
- func (f *Function) Generate() error
- func (f *Function) SetBasicBlock(block *ir.Block)
- func (f *Function) String() []string
- type Global
- type IfStmt
- type IndexOp
- type LoadOp
- type Module
- func (m *Module) AddGlobal(v *Variable)
- func (m *Module) AddLocal(v *Variable) error
- func (m *Module) AddLocalType(alias string, typ *Type)
- func (m *Module) AddModuleTypeDef(alias string, typ *Type)
- func (m *Module) BasicBlock() *ir.Block
- func (m *Module) Current() *Scope
- func (m *Module) CurrentFunction() *Function
- func (m *Module) CurrentModule() *Module
- func (m *Module) FindFunction(ident string) *Function
- func (m *Module) FindTypeDefByAlias(alias string) *TypeDef
- func (m *Module) FindTypeDefByType(typ *Type) *TypeDef
- func (m *Module) FindVariable(ident string) *Variable
- func (m *Module) Generate() (*ir.Module, error)
- func (m *Module) GenerateID(prefix string) string
- func (m *Module) SetBasicBlock(b *ir.Block)
- func (m *Module) String() []string
- type ReturnStmt
- type Scope
- type ScopeLike
- type SizeOfOp
- type StatementLike
- type StatementLikeList
- type StructField
- type StructType
- type Type
- func (t *Type) Alias() string
- func (t *Type) AliasOf(o *Type) bool
- func (t *Type) AliasedType() *Type
- func (t *Type) Array() *ArrayType
- func (t *Type) Basic() BasicType
- func (t *Type) BasicSize() int
- func (t *Type) Equals(o *Type) bool
- func (t *Type) IRType() (types.Type, error)
- func (t *Type) IsAlias() bool
- func (t *Type) IsArray() bool
- func (t *Type) IsBasic() bool
- func (t *Type) IsBool() bool
- func (t *Type) IsFloat() bool
- func (t *Type) IsInt() bool
- func (t *Type) IsPointer() bool
- func (t *Type) IsStruct() bool
- func (t *Type) IsUInt() bool
- func (t *Type) IsVoid() bool
- func (t *Type) LLVMFloatType() *types.FloatType
- func (t *Type) LLVMIntType() *types.IntType
- func (t *Type) NewArray(len int) *Type
- func (t *Type) NewPointer() *Type
- func (t *Type) Pointer() *Type
- func (t *Type) PointerLevel() int
- func (t *Type) String() string
- func (t *Type) Struct() *StructType
- type TypeDef
- type UnaryOp
- type Value
- type Variable
- type VariableList
- type WhileStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLLTypeBool ¶
func NewLLTypeFloat ¶
func NewLLTypeInt ¶
func NewLLTypeVoid ¶
Types ¶
type AccessorOp ¶
type AccessorOp struct { Expr ExpressionLike Field string Dereference bool Scope ScopeLike Pos lexer.Position }
func (*AccessorOp) String ¶
func (ao *AccessorOp) String() string
func (*AccessorOp) Value ¶
func (ao *AccessorOp) Value() (*Value, error)
type AssignStmt ¶
type AssignStmt struct { Type *Type Left ExpressionLike Right ExpressionLike Scope ScopeLike Pos lexer.Position }
func (*AssignStmt) Generate ¶
func (a *AssignStmt) Generate() error
func (*AssignStmt) String ¶
func (a *AssignStmt) String() []string
type BasicType ¶
type BasicType string
const ( BasicTypeBool BasicType = "bool" BasicTypeVoid BasicType = "void" BasicTypeI8 BasicType = "i8" BasicTypeI16 BasicType = "i16" BasicTypeI32 BasicType = "i32" BasicTypeI64 BasicType = "i64" BasicTypeUI8 BasicType = "u8" BasicTypeUI16 BasicType = "u16" BasicTypeUI32 BasicType = "u32" BasicTypeUI64 BasicType = "u64" BasicTypeF32 BasicType = "f32" BasicTypeF64 BasicType = "f64" )
type BinaryOp ¶
type BinaryOp struct { Left ExpressionLike Op string Right ExpressionLike Scope ScopeLike Pos lexer.Position }
type Block ¶
type Block struct { Stmts []StatementLike Locals []*Variable Scope *Scope Pos lexer.Position }
func (*Block) AddLocalType ¶
func (*Block) AddModuleTypeDef ¶
func (*Block) BasicBlock ¶
func (*Block) CurrentFunction ¶
func (*Block) CurrentModule ¶
func (*Block) FindFunction ¶
func (*Block) FindTypeDefByAlias ¶
func (*Block) FindTypeDefByType ¶
func (*Block) FindVariable ¶
func (*Block) SetBasicBlock ¶
type CastingOp ¶
type CastingOp struct { Type *Type Expr ExpressionLike Scope ScopeLike Pos lexer.Position }
type ConstantBoolOp ¶
func (*ConstantBoolOp) String ¶
func (c *ConstantBoolOp) String() string
func (*ConstantBoolOp) Value ¶
func (c *ConstantBoolOp) Value() (*Value, error)
type ConstantCharOp ¶
func (*ConstantCharOp) String ¶
func (c *ConstantCharOp) String() string
func (*ConstantCharOp) Value ¶
func (c *ConstantCharOp) Value() (*Value, error)
type ConstantNumberOp ¶
func (*ConstantNumberOp) String ¶
func (c *ConstantNumberOp) String() string
func (*ConstantNumberOp) Value ¶
func (c *ConstantNumberOp) Value() (*Value, error)
type ConstantStringOp ¶
func (*ConstantStringOp) String ¶
func (c *ConstantStringOp) String() string
func (*ConstantStringOp) Value ¶
func (c *ConstantStringOp) Value() (*Value, error)
type DeclStmt ¶
type ExpressionLike ¶
type ExpressionLikeList ¶
type ExpressionLikeList []ExpressionLike
func (ExpressionLikeList) String ¶
func (e ExpressionLikeList) String() string
type FnCallOp ¶
type FnCallOp struct { Ident string Args []ExpressionLike Scope ScopeLike Pos lexer.Position }
type Function ¶
type Function struct { Name string Params []*Variable Variadic bool ReturnType *Type Body []StatementLike OnlyDeclare bool Locals []*Variable Ptr *ir.Func Scope *Scope Pos lexer.Position }
func (*Function) AddLocalType ¶
func (*Function) AddModuleTypeDef ¶
func (*Function) BasicBlock ¶
func (*Function) CurrentFunction ¶
func (*Function) CurrentModule ¶
func (*Function) FindFunction ¶
func (*Function) FindTypeDefByAlias ¶
func (*Function) FindTypeDefByType ¶
func (*Function) FindVariable ¶
func (*Function) SetBasicBlock ¶
type IfStmt ¶
type IfStmt struct { Condition ExpressionLike Then []StatementLike Else []StatementLike Scope ScopeLike Pos lexer.Position }
type IndexOp ¶
type IndexOp struct { Op string Expr ExpressionLike IndexExpr ExpressionLike Scope ScopeLike Pos lexer.Position }
type Module ¶
type Module struct { Functions []*Function ModuleTypeDefs []*TypeDef LocalTypes []*TypeDef Globals []*Global Ptr *ir.Module LastID int CurrentBlock *ir.Block Scope *Scope Pos lexer.Position }
func (*Module) AddLocalType ¶
func (*Module) AddModuleTypeDef ¶
func (*Module) BasicBlock ¶
func (*Module) CurrentFunction ¶
func (*Module) CurrentModule ¶
func (*Module) FindFunction ¶
func (*Module) FindTypeDefByAlias ¶
func (*Module) FindTypeDefByType ¶
func (*Module) FindVariable ¶
func (*Module) GenerateID ¶
func (*Module) SetBasicBlock ¶
type ReturnStmt ¶
type ReturnStmt struct { Expr ExpressionLike Scope ScopeLike Pos lexer.Position }
func (*ReturnStmt) Generate ¶
func (r *ReturnStmt) Generate() error
func (*ReturnStmt) String ¶
func (r *ReturnStmt) String() []string
type ScopeLike ¶
type ScopeLike interface { Current() *Scope AddModuleTypeDef(alias string, typ *Type) AddLocalType(alias string, typ *Type) AddGlobal(v *Variable) AddLocal(v *Variable) error FindTypeDefByAlias(alias string) *TypeDef FindTypeDefByType(typ *Type) *TypeDef FindVariable(ident string) *Variable FindFunction(ident string) *Function CurrentModule() *Module CurrentFunction() *Function BasicBlock() *ir.Block SetBasicBlock(b *ir.Block) }
type SizeOfOp ¶
type SizeOfOp struct { Type *Type Expr ExpressionLike Scope ScopeLike Pos lexer.Position }
type StatementLike ¶
type StatementLikeList ¶
type StatementLikeList []StatementLike
func (StatementLikeList) String ¶
func (s StatementLikeList) String() []string
type StructField ¶
func (*StructField) String ¶
func (st *StructField) String() string
type StructType ¶
type StructType struct {
Fields []*StructField
}
func (*StructType) Equals ¶
func (st *StructType) Equals(o *StructType) bool
func (*StructType) FindField ¶
func (st *StructType) FindField(field string) (int, *StructField, error)
func (*StructType) String ¶
func (st *StructType) String() string
type Type ¶
func NewTypeStruct ¶
func NewTypeStruct(scope ScopeLike, pos lexer.Position, fields ...*StructField) *Type
func (*Type) AliasOf ¶
AliasOf returns true if types are compatible to each other to be used for casting
func (*Type) AliasedType ¶
AliasedType returns the type at the end of the alias chain.
func (*Type) LLVMFloatType ¶
func (*Type) LLVMIntType ¶
func (*Type) NewPointer ¶
func (*Type) PointerLevel ¶
func (*Type) Struct ¶
func (t *Type) Struct() *StructType
type UnaryOp ¶
type Variable ¶
type VariableList ¶
type VariableList []*Variable
func (VariableList) String ¶
func (vl VariableList) String() string
Click to show internal directories.
Click to hide internal directories.