goll

package module
v0.0.0-...-dfa1d3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 12 Imported by: 0

README

goll

A(nother) Go to LLVM compiler!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileDir

func CompileDir(dir string) (*ir.Module, error)

func CompileSrc

func CompileSrc(filename string, src string) (*ir.Module, error)

func EvaluateString

func EvaluateString(s string) string

Types

type Boolean

type Boolean struct {
	// contains filtered or unexported fields
}

func NewBool

func NewBool(val value.Value) *Boolean

func NewBoolConst

func NewBoolConst(val bool) *Boolean

func (*Boolean) Cleanup

func (b *Boolean) Cleanup(_ *Program)

func (*Boolean) Copy

func (b *Boolean) Copy() Value

func (*Boolean) Data

func (b *Boolean) Data(_ *Program) value.Value

func (*Boolean) SetOwned

func (b *Boolean) SetOwned(_ bool)

func (*Boolean) SetValue

func (b *Boolean) SetValue(newVal value.Value)

func (*Boolean) Value

func (b *Boolean) Value() value.Value

type Float

type Float struct {
	// contains filtered or unexported fields
}

func NewFloat

func NewFloat(kind *types.FloatType, val value.Value) *Float

func NewFloatConst

func NewFloatConst(kind *types.FloatType, val float64) *Float

func (*Float) Cleanup

func (f *Float) Cleanup(_ *Program)

func (*Float) Copy

func (f *Float) Copy() Value

func (*Float) Data

func (f *Float) Data(p *Program) value.Value

func (*Float) IsShort

func (f *Float) IsShort() bool

func (*Float) Long

func (f *Float) Long(p *Program) value.Value

func (*Float) SetOwned

func (f *Float) SetOwned(_ bool)

func (*Float) SetValue

func (f *Float) SetValue(newVal value.Value)

func (*Float) Short

func (f *Float) Short(p *Program) value.Value

func (*Float) Value

func (f *Float) Value() value.Value

type Int

type Int struct {
	// contains filtered or unexported fields
}

func NewInt

func NewInt(kind *types.IntType, val value.Value) *Int

func NewIntConst

func NewIntConst(kind *types.IntType, val int64) *Int

func (*Int) Cleanup

func (i *Int) Cleanup(_ *Program)

func (*Int) Copy

func (i *Int) Copy() Value

func (*Int) Data

func (i *Int) Data(_ *Program) value.Value

func (*Int) IsShort

func (i *Int) IsShort() bool

func (*Int) Long

func (i *Int) Long(p *Program) value.Value

func (*Int) SetOwned

func (i *Int) SetOwned(_ bool)

func (*Int) SetValue

func (i *Int) SetValue(newVal value.Value)

func (*Int) Short

func (i *Int) Short(p *Program) value.Value

func (*Int) Value

func (i *Int) Value() value.Value

type Module

type Module map[string]func(p *Program, args ...ast.Expr) (Value, error)

type Program

type Program struct {
	M    *ir.Module
	Fset *token.FileSet

	Fn    *ir.Func
	Block *ir.Block

	Vars    map[string]Variable
	Funcs   map[string]*ir.Func
	Modules map[string]Module

	TmpUsed int

	CFuncs map[string]*ir.Func
}

func (*Program) AddFile

func (p *Program) AddFile(file *ast.File) error

func (*Program) BinaryExpr

func (p *Program) BinaryExpr(lhs, rhs Value, op token.Token, opPos token.Pos, lPos token.Pos) (Value, error)

func (*Program) BinaryExprFloat

func (p *Program) BinaryExprFloat(l, r *Float, op token.Token, opPos token.Pos, lPos token.Pos) (Value, error)

func (*Program) BinaryExprInt

func (p *Program) BinaryExprInt(l, r *Int, op token.Token, opPos token.Pos, lPos token.Pos) (Value, error)

func (*Program) BinaryExprString

func (p *Program) BinaryExprString(l, r *String, op token.Token, opPos token.Pos, lPos token.Pos) (Value, error)

func (*Program) CleanupFunc

func (p *Program) CleanupFunc()

func (*Program) CompileAssignStmt

func (p *Program) CompileAssignStmt(stm *ast.AssignStmt) error

func (*Program) CompileBasicLit

func (p *Program) CompileBasicLit(lit *ast.BasicLit) (Value, error)

func (*Program) CompileBinaryExpr

func (p *Program) CompileBinaryExpr(expr *ast.BinaryExpr) (Value, error)

func (*Program) CompileCallExpr

func (p *Program) CompileCallExpr(expr *ast.CallExpr) (Value, error)

func (*Program) CompileDecl

func (p *Program) CompileDecl(decl ast.Decl) error

func (*Program) CompileExpr

func (p *Program) CompileExpr(expr ast.Expr) (Value, error)

func (*Program) CompileForStmt

func (p *Program) CompileForStmt(stm *ast.ForStmt) error

func (*Program) CompileFuncDecl

func (p *Program) CompileFuncDecl(decl *ast.FuncDecl) error

func (*Program) CompileGenDecl

func (p *Program) CompileGenDecl(decl *ast.GenDecl) error

func (*Program) CompileIdent

func (p *Program) CompileIdent(stm *ast.Ident) (Value, error)

func (*Program) CompileIfStmt

func (p *Program) CompileIfStmt(stm *ast.IfStmt) error

func (*Program) CompileIncDecStmt

func (p *Program) CompileIncDecStmt(stm *ast.IncDecStmt) error

func (*Program) CompileReturnStmt

func (p *Program) CompileReturnStmt(stm *ast.ReturnStmt) error

func (*Program) CompileSpec

func (p *Program) CompileSpec(spec ast.Spec) error

func (*Program) CompileStmt

func (p *Program) CompileStmt(stmt ast.Stmt) error

func (*Program) ConvertTypeString

func (p *Program) ConvertTypeString(t string) types.Type

func (*Program) End

func (p *Program) End()

func (*Program) GetStorable

func (p *Program) GetStorable(expr ast.Expr, val Value, redefine bool) (value.Value, error)

func (*Program) GetValFromType

func (p *Program) GetValFromType(n ast.Node, kind types.Type) (Value, error)

func (*Program) NewString

func (p *Program) NewString(len value.Value, val value.Value) *String

func (*Program) NewStringFromGo

func (p *Program) NewStringFromGo(val string) *String

func (*Program) Pos

func (p *Program) Pos(node ast.Node) string

type String

type String struct {
	// contains filtered or unexported fields
}

func (*String) Cleanup

func (s *String) Cleanup(p *Program)

func (*String) Copy

func (s *String) Copy() Value

func (*String) Data

func (s *String) Data(p *Program) value.Value

func (*String) SetOwned

func (s *String) SetOwned(owned bool)

func (*String) SetValue

func (s *String) SetValue(newVal value.Value)

func (*String) Value

func (s *String) Value() value.Value

type Value

type Value interface {
	Cleanup(p *Program)
	SetOwned(bool)
	Value() value.Value
	Data(p *Program) value.Value
	Copy() Value
	SetValue(value.Value)
}

type Variable

type Variable struct {
	Storage value.Value
	Value   Value
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL