Documentation
¶
Index ¶
- Constants
- func CharEncodeLutOutTrit(trit []int8) byte
- func GetConstValue(expr ExpressionInterface) (int, error)
- func IsNullExpr(e interface{}) bool
- func MatchSizes(e1, e2 ExpressionInterface) error
- func NewFunctionEntity(sv *Supervisor, function *Function) (*Entity, error)
- func RequireSize(e ExpressionInterface, size int) error
- func Trits3ToLutIdx(trits Trits) int
- type ConcatExpr
- type CondExpr
- type ConstExpression
- type ConstTypeFieldInfo
- type ConstTypeInfo
- func (e *ConstTypeInfo) Copy() ExpressionInterface
- func (e *ConstTypeInfo) Eval(_ *EvalFrame, _ Trits) bool
- func (e *ConstTypeInfo) GetAbraSite(branch *abra.Branch, codeUnit *abra.CodeUnit, lookupName string) *abra.Site
- func (e *ConstTypeInfo) GetConstName() string
- func (e *ConstTypeInfo) GetConstValue() int
- func (e *ConstTypeInfo) GetFieldInfo(fldname string) (*ConstTypeFieldInfo, error)
- func (e *ConstTypeInfo) GetSource() string
- func (e *ConstTypeInfo) GetSubexpressions() []ExpressionInterface
- func (e *ConstTypeInfo) HasState() bool
- func (e *ConstTypeInfo) References(_ string) bool
- func (e *ConstTypeInfo) SetSubexpressions(_ []ExpressionInterface)
- func (e *ConstTypeInfo) Size() int
- type ConstValue
- func (e *ConstValue) Copy() ExpressionInterface
- func (_ *ConstValue) Eval(_ *EvalFrame, _ Trits) bool
- func (e *ConstValue) GetAbraSite(branch *abra.Branch, codeUnit *abra.CodeUnit, lookupName string) *abra.Site
- func (e *ConstValue) GetConstName() string
- func (e *ConstValue) GetConstValue() int
- func (e *ConstValue) GetTrits() Trits
- func (e *ConstValue) Size() int
- type EvalFrame
- type ExecStmt
- type ExpressionBase
- func (e *ExpressionBase) AppendSubExpr(se ExpressionInterface)
- func (e *ExpressionBase) GetSource() string
- func (e *ExpressionBase) GetSubExpr(idx int) ExpressionInterface
- func (e *ExpressionBase) GetSubexpressions() []ExpressionInterface
- func (e *ExpressionBase) HasState() bool
- func (e *ExpressionBase) HasSubExpr() bool
- func (e *ExpressionBase) NumSubExpr() int
- func (e *ExpressionBase) References(funName string) bool
- func (e *ExpressionBase) ReferencesSubExprs(funName string) bool
- func (e *ExpressionBase) SetSubexpressions(subExpr []ExpressionInterface)
- type ExpressionInterface
- type FieldExpr
- type Function
- func (def *Function) AppendInline(s string)
- func (def *Function) ArgSize() int
- func (def *Function) CheckArgSizes(args []ExpressionInterface) error
- func (def *Function) Eval(frame *EvalFrame, result Trits) bool
- func (def *Function) GetAbraBranchBlock(codeUnit *abra.CodeUnit) *abra.Block
- func (def *Function) GetAffectEnv() map[string]int
- func (def *Function) GetJoinEnv() map[string]int
- func (def *Function) GetLookupName() string
- func (def *Function) GetVarIdx(name string) int
- func (def *Function) HasEnvStmt() bool
- func (def *Function) HasState() bool
- func (def *Function) NewFuncExpressionWithNulls(callIndex byte) *FunctionExpr
- func (def *Function) NextCallIndex() byte
- func (def *Function) References(funName string) bool
- func (def *Function) SetTraceLevel(traceLevel int)
- func (def *Function) Size() int
- func (def *Function) Stats() map[string]int
- func (def *Function) VarByIdx(idx int) (*QuplaSite, error)
- func (def *Function) VarByName(name string) (*QuplaSite, error)
- func (def *Function) WasInline(s string) bool
- type FunctionCalculator
- type FunctionExpr
- func (e *FunctionExpr) Copy() ExpressionInterface
- func (e *FunctionExpr) Eval(frame *EvalFrame, result Trits) bool
- func (e *FunctionExpr) GetAbraSite(branch *abra.Branch, codeUnit *abra.CodeUnit, lookupName string) *abra.Site
- func (e *FunctionExpr) HasState() bool
- func (e *FunctionExpr) References(funName string) bool
- func (e *FunctionExpr) Size() int
- type LutDef
- type LutExpr
- type MergeExpr
- type NullExpr
- type QuplaFieldExpr
- type QuplaModule
- func (module *QuplaModule) AddExec(exec *ExecStmt)
- func (module *QuplaModule) AddFuncDef(name string, funcDef *Function) error
- func (module *QuplaModule) AddLutDef(name string, lutDef *LutDef)
- func (module *QuplaModule) AttachExecs(disp *supervisor.Supervisor, fromIdx int, toIdx int, chain bool) []*ExecStmt
- func (module *QuplaModule) AttachToSupervisor(sv *supervisor.Supervisor) bool
- func (module *QuplaModule) ExecByIdx(idx int) *ExecStmt
- func (module *QuplaModule) FindExecs(filterSubstr string) []*ExecStmt
- func (module *QuplaModule) FindFuncDef(name string) *Function
- func (module *QuplaModule) FindFuncs(filterSubstr string) []*Function
- func (module *QuplaModule) FindLUTDef(name string) (*LutDef, error)
- func (module *QuplaModule) GetAbra(codeUnit *abra.CodeUnit)
- func (module *QuplaModule) GetName() string
- func (module *QuplaModule) GetStat(key string) int
- func (module *QuplaModule) GetStateHashMap() *StateHashMap
- func (module *QuplaModule) GetTypeFieldInfo(typeName, fldName string) (int64, int64, error)
- func (module *QuplaModule) IncStat(key string)
- func (module *QuplaModule) MarkStateful() (int, int)
- func (module *QuplaModule) PrintStats()
- func (module *QuplaModule) RunExec(disp *supervisor.Supervisor, idx int, repeat int) error
- func (module *QuplaModule) RunExecs(disp *supervisor.Supervisor, fromIdx int, toIdx int, chain bool) error
- func (module *QuplaModule) SetTraceLevel(traceLevel int, filterSubstr string) []*Function
- type QuplaSite
- type QuplaTypeDef
- type QuplaTypeField
- type SizeofExpr
- type SliceExpr
- func (e *SliceExpr) Copy() ExpressionInterface
- func (e *SliceExpr) Eval(frame *EvalFrame, result Trits) bool
- func (e *SliceExpr) GetAbraSite(branch *abra.Branch, codeUnit *abra.CodeUnit, lookupName string) *abra.Site
- func (e *SliceExpr) GetAbraSiteForNonparamVar(branch *abra.Branch, codeUnit *abra.CodeUnit, vi *QuplaSite) *abra.Site
- func (e *SliceExpr) Site() *QuplaSite
- func (e *SliceExpr) Size() int
- type SliceInline
- type StateHashMap
- type TypeExpr
- type ValueExpr
Constants ¶
View Source
const ( BOOL_TRUE = 1 BOOL_FALSE = -1 )
Variables ¶
This section is empty.
Functions ¶
func CharEncodeLutOutTrit ¶
func GetConstValue ¶
func GetConstValue(expr ExpressionInterface) (int, error)
func IsNullExpr ¶
func IsNullExpr(e interface{}) bool
func MatchSizes ¶
func MatchSizes(e1, e2 ExpressionInterface) error
func NewFunctionEntity ¶
func RequireSize ¶
func RequireSize(e ExpressionInterface, size int) error
func Trits3ToLutIdx ¶
func Trits3ToLutIdx(trits Trits) int
Types ¶
type ConcatExpr ¶
type ConcatExpr struct {
ExpressionBase
// contains filtered or unexported fields
}
func NewConcatExpression ¶
func NewConcatExpression(src string, args []ExpressionInterface) *ConcatExpr
func (*ConcatExpr) Copy ¶
func (e *ConcatExpr) Copy() ExpressionInterface
func (*ConcatExpr) Eval ¶
func (e *ConcatExpr) Eval(frame *EvalFrame, result Trits) bool
func (*ConcatExpr) GetAbraSite ¶
func (*ConcatExpr) Size ¶
func (e *ConcatExpr) Size() int
type CondExpr ¶
type CondExpr struct {
ExpressionBase
}
func (*CondExpr) Copy ¶
func (e *CondExpr) Copy() ExpressionInterface
func (*CondExpr) GetAbraSite ¶
type ConstExpression ¶
type ConstExpression interface {
ExpressionInterface
GetConstValue() int
GetConstName() string
}
type ConstTypeFieldInfo ¶
type ConstTypeInfo ¶
type ConstTypeInfo struct {
Fields map[string]*ConstTypeFieldInfo
// contains filtered or unexported fields
}
func NewConstTypeInfo ¶
func NewConstTypeInfo(name string, size int) *ConstTypeInfo
func (*ConstTypeInfo) Copy ¶
func (e *ConstTypeInfo) Copy() ExpressionInterface
func (*ConstTypeInfo) Eval ¶
func (e *ConstTypeInfo) Eval(_ *EvalFrame, _ Trits) bool
func (*ConstTypeInfo) GetAbraSite ¶
func (*ConstTypeInfo) GetConstName ¶
func (e *ConstTypeInfo) GetConstName() string
func (*ConstTypeInfo) GetConstValue ¶
func (e *ConstTypeInfo) GetConstValue() int
func (*ConstTypeInfo) GetFieldInfo ¶
func (e *ConstTypeInfo) GetFieldInfo(fldname string) (*ConstTypeFieldInfo, error)
func (*ConstTypeInfo) GetSource ¶
func (e *ConstTypeInfo) GetSource() string
func (*ConstTypeInfo) GetSubexpressions ¶
func (e *ConstTypeInfo) GetSubexpressions() []ExpressionInterface
func (*ConstTypeInfo) HasState ¶
func (e *ConstTypeInfo) HasState() bool
func (*ConstTypeInfo) References ¶
func (e *ConstTypeInfo) References(_ string) bool
func (*ConstTypeInfo) SetSubexpressions ¶
func (e *ConstTypeInfo) SetSubexpressions(_ []ExpressionInterface)
func (*ConstTypeInfo) Size ¶
func (e *ConstTypeInfo) Size() int
type ConstValue ¶
type ConstValue struct {
ExpressionBase
// contains filtered or unexported fields
}
func NewConstValue ¶
func NewConstValue(name string, value int) *ConstValue
func (*ConstValue) Copy ¶
func (e *ConstValue) Copy() ExpressionInterface
func (*ConstValue) Eval ¶
func (_ *ConstValue) Eval(_ *EvalFrame, _ Trits) bool
func (*ConstValue) GetAbraSite ¶
func (*ConstValue) GetConstName ¶
func (e *ConstValue) GetConstName() string
func (*ConstValue) GetConstValue ¶
func (e *ConstValue) GetConstValue() int
func (*ConstValue) GetTrits ¶
func (e *ConstValue) GetTrits() Trits
func (*ConstValue) Size ¶
func (e *ConstValue) Size() int
type EvalFrame ¶
type EvalFrame struct {
// contains filtered or unexported fields
}
func (*EvalFrame) SaveStateVariables ¶
func (frame *EvalFrame) SaveStateVariables()
type ExecStmt ¶
type ExecStmt struct {
ExpressionBase
Expr ExpressionInterface // *FunctionExpr
// contains filtered or unexported fields
}
func NewExecStmt ¶
func NewExecStmt(src string, expr ExpressionInterface, isTest, isFloat bool, expected Trits, module *QuplaModule) *ExecStmt
func (*ExecStmt) GetRunResults ¶
func (ex *ExecStmt) GetRunResults() *runSummary
type ExpressionBase ¶
type ExpressionBase struct {
// contains filtered or unexported fields
}
func NewExpressionBase ¶
func NewExpressionBase(source string) ExpressionBase
func (*ExpressionBase) AppendSubExpr ¶
func (e *ExpressionBase) AppendSubExpr(se ExpressionInterface)
func (*ExpressionBase) GetSource ¶
func (e *ExpressionBase) GetSource() string
func (*ExpressionBase) GetSubExpr ¶
func (e *ExpressionBase) GetSubExpr(idx int) ExpressionInterface
func (*ExpressionBase) GetSubexpressions ¶
func (e *ExpressionBase) GetSubexpressions() []ExpressionInterface
func (*ExpressionBase) HasState ¶
func (e *ExpressionBase) HasState() bool
func (*ExpressionBase) HasSubExpr ¶
func (e *ExpressionBase) HasSubExpr() bool
func (*ExpressionBase) NumSubExpr ¶
func (e *ExpressionBase) NumSubExpr() int
func (*ExpressionBase) References ¶
func (e *ExpressionBase) References(funName string) bool
func (*ExpressionBase) ReferencesSubExprs ¶
func (e *ExpressionBase) ReferencesSubExprs(funName string) bool
func (*ExpressionBase) SetSubexpressions ¶
func (e *ExpressionBase) SetSubexpressions(subExpr []ExpressionInterface)
type ExpressionInterface ¶
type ExpressionInterface interface {
Size() int
Eval(*EvalFrame, Trits) bool
References(string) bool
HasState() bool
Copy() ExpressionInterface // shallow copy
GetSubexpressions() []ExpressionInterface
SetSubexpressions([]ExpressionInterface)
GetSource() string
GetAbraSite(branch *abra.Branch, codeUnit *abra.CodeUnit, lookupName string) *abra.Site
}
type Function ¶
type Function struct {
Analyzed bool // finished analysis
Joins map[string]int
Affects map[string]int
Name string
RetExpr ExpressionInterface
Sites []*QuplaSite
NumParams int // idx < NumParams represents parameter, idx >= represents local var (assign)
BufLen int // total length of the local var buffer
HasStateVariables bool // if has state vars itself
InSize int
ParamSizes []int
StateHashMap *StateHashMap
// contains filtered or unexported fields
}
func NewFunction ¶
func NewFunction(name string, size int, module *QuplaModule) *Function
func (*Function) AppendInline ¶
func (*Function) CheckArgSizes ¶
func (def *Function) CheckArgSizes(args []ExpressionInterface) error
func (*Function) GetAbraBranchBlock ¶
func (*Function) GetAffectEnv ¶
func (*Function) GetJoinEnv ¶
func (*Function) GetLookupName ¶
func (*Function) HasEnvStmt ¶
func (*Function) NewFuncExpressionWithNulls ¶
func (def *Function) NewFuncExpressionWithNulls(callIndex byte) *FunctionExpr
mock expression with all null arguments
func (*Function) NextCallIndex ¶
func (*Function) References ¶
func (*Function) SetTraceLevel ¶
type FunctionCalculator ¶
type FunctionCalculator struct {
// contains filtered or unexported fields
}
func NewFunctionCalculator ¶
func NewFunctionCalculator(function *Function) *FunctionCalculator
type FunctionExpr ¶
type FunctionExpr struct {
ExpressionBase
FuncDef *Function
// contains filtered or unexported fields
}
func NewFunctionExpr ¶
func NewFunctionExpr(src string, funcDef *Function, callIndex uint8) *FunctionExpr
func (*FunctionExpr) Copy ¶
func (e *FunctionExpr) Copy() ExpressionInterface
func (*FunctionExpr) Eval ¶
func (e *FunctionExpr) Eval(frame *EvalFrame, result Trits) bool
func (*FunctionExpr) GetAbraSite ¶
func (*FunctionExpr) HasState ¶
func (e *FunctionExpr) HasState() bool
func (*FunctionExpr) References ¶
func (e *FunctionExpr) References(funName string) bool
func (*FunctionExpr) Size ¶
func (e *FunctionExpr) Size() int
type LutDef ¶
func (*LutDef) GetStringRepr ¶
func (*LutDef) GetTritcode ¶
func (lutDef *LutDef) GetTritcode() Trits
func (*LutDef) LookupTable ¶
func (lutDef *LutDef) LookupTable() [27]Trits
lookup table adjusted for 3 inputs
type LutExpr ¶
type LutExpr struct {
ExpressionBase
LutDef *LutDef
}
func (*LutExpr) Copy ¶
func (e *LutExpr) Copy() ExpressionInterface
func (*LutExpr) GetAbraSite ¶
type MergeExpr ¶
type MergeExpr struct {
ExpressionBase
}
func NewMergeExpression ¶
func NewMergeExpression(src string, args []ExpressionInterface) *MergeExpr
func (*MergeExpr) Copy ¶
func (e *MergeExpr) Copy() ExpressionInterface
func (*MergeExpr) GetAbraSite ¶
type NullExpr ¶
type NullExpr struct {
ExpressionBase
// contains filtered or unexported fields
}
func NewNullExpr ¶
func (*NullExpr) Copy ¶
func (e *NullExpr) Copy() ExpressionInterface
func (*NullExpr) GetAbraSite ¶
type QuplaFieldExpr ¶
type QuplaFieldExpr struct {
ExpressionBase
}
TODO with fields expressions
func NewFieldExpr ¶
func NewFieldExpr(src string, condExpr ExpressionInterface) *QuplaFieldExpr
func (*QuplaFieldExpr) Copy ¶
func (e *QuplaFieldExpr) Copy() ExpressionInterface
func (*QuplaFieldExpr) Eval ¶
func (e *QuplaFieldExpr) Eval(_ *EvalFrame, _ Trits) bool
func (*QuplaFieldExpr) GetAbraSite ¶
func (*QuplaFieldExpr) Size ¶
func (e *QuplaFieldExpr) Size() int
type QuplaModule ¶
type QuplaModule struct {
Luts map[string]*LutDef
Functions map[string]*Function
Execs []*ExecStmt
Environments StringSet
// contains filtered or unexported fields
}
func NewQuplaModule ¶
func NewQuplaModule(name string) *QuplaModule
func (*QuplaModule) AddExec ¶
func (module *QuplaModule) AddExec(exec *ExecStmt)
func (*QuplaModule) AddFuncDef ¶
func (module *QuplaModule) AddFuncDef(name string, funcDef *Function) error
func (*QuplaModule) AddLutDef ¶
func (module *QuplaModule) AddLutDef(name string, lutDef *LutDef)
func (*QuplaModule) AttachExecs ¶
func (module *QuplaModule) AttachExecs(disp *supervisor.Supervisor, fromIdx int, toIdx int, chain bool) []*ExecStmt
func (*QuplaModule) AttachToSupervisor ¶
func (module *QuplaModule) AttachToSupervisor(sv *supervisor.Supervisor) bool
func (*QuplaModule) ExecByIdx ¶
func (module *QuplaModule) ExecByIdx(idx int) *ExecStmt
func (*QuplaModule) FindExecs ¶
func (module *QuplaModule) FindExecs(filterSubstr string) []*ExecStmt
func (*QuplaModule) FindFuncDef ¶
func (module *QuplaModule) FindFuncDef(name string) *Function
func (*QuplaModule) FindFuncs ¶
func (module *QuplaModule) FindFuncs(filterSubstr string) []*Function
func (*QuplaModule) FindLUTDef ¶
func (module *QuplaModule) FindLUTDef(name string) (*LutDef, error)
func (*QuplaModule) GetAbra ¶
func (module *QuplaModule) GetAbra(codeUnit *abra.CodeUnit)
func (*QuplaModule) GetName ¶
func (module *QuplaModule) GetName() string
func (*QuplaModule) GetStat ¶
func (module *QuplaModule) GetStat(key string) int
func (*QuplaModule) GetStateHashMap ¶
func (module *QuplaModule) GetStateHashMap() *StateHashMap
func (*QuplaModule) GetTypeFieldInfo ¶
func (module *QuplaModule) GetTypeFieldInfo(typeName, fldName string) (int64, int64, error)
func (*QuplaModule) IncStat ¶
func (module *QuplaModule) IncStat(key string)
func (*QuplaModule) MarkStateful ¶
func (module *QuplaModule) MarkStateful() (int, int)
func (*QuplaModule) PrintStats ¶
func (module *QuplaModule) PrintStats()
func (*QuplaModule) RunExec ¶
func (module *QuplaModule) RunExec(disp *supervisor.Supervisor, idx int, repeat int) error
func (*QuplaModule) RunExecs ¶
func (module *QuplaModule) RunExecs(disp *supervisor.Supervisor, fromIdx int, toIdx int, chain bool) error
func (*QuplaModule) SetTraceLevel ¶
func (module *QuplaModule) SetTraceLevel(traceLevel int, filterSubstr string) []*Function
type QuplaSite ¶
type QuplaSite struct {
Name string
Analyzed bool
Idx int
Offset int
Size int
SliceEnd int // Offset + size precalculated
IsState bool
IsParam bool
Assign ExpressionInterface
NumUses int // number of times referenced in the scope (by slice expressions)
NotUsed bool // optimized away
}
func (*QuplaSite) GetAbraLookupName ¶
func (*QuplaSite) IncNumUses ¶
func (vi *QuplaSite) IncNumUses()
type QuplaTypeDef ¶
type QuplaTypeDef struct {
// contains filtered or unexported fields
}
type QuplaTypeField ¶
type QuplaTypeField struct {
// contains filtered or unexported fields
}
type SizeofExpr ¶
type SizeofExpr struct {
ExpressionBase
Value int64
TritValue Trits
}
func NewQuplaSizeofExpr ¶
func NewQuplaSizeofExpr(value int64, tritValue Trits) *SizeofExpr
func (*SizeofExpr) Copy ¶
func (e *SizeofExpr) Copy() ExpressionInterface
func (*SizeofExpr) Eval ¶
func (e *SizeofExpr) Eval(_ *EvalFrame, result Trits) bool
func (*SizeofExpr) GetAbraSite ¶
func (*SizeofExpr) Size ¶
func (e *SizeofExpr) Size() int
type SliceExpr ¶
type SliceExpr struct {
ExpressionBase
// contains filtered or unexported fields
}
func NewQuplaSliceExpr ¶
func (*SliceExpr) Copy ¶
func (e *SliceExpr) Copy() ExpressionInterface
func (*SliceExpr) GetAbraSite ¶
func (*SliceExpr) GetAbraSiteForNonparamVar ¶
type SliceInline ¶
type SliceInline struct {
ExpressionBase
OrigSiteName string // original name
Offset int
SliceEnd int
NoSlice bool
// contains filtered or unexported fields
}
func NewSliceInline ¶
func NewSliceInline(sliceExpr *SliceExpr, expr ExpressionInterface) *SliceInline
func (*SliceInline) Copy ¶
func (e *SliceInline) Copy() ExpressionInterface
func (*SliceInline) Eval ¶
func (e *SliceInline) Eval(frame *EvalFrame, result Trits) bool
func (*SliceInline) GetAbraSite ¶
func (*SliceInline) Size ¶
func (e *SliceInline) Size() int
type StateHashMap ¶
type TypeExpr ¶
type TypeExpr struct {
ExpressionBase
Fields []*FieldExpr
// contains filtered or unexported fields
}
func NewQuplaTypeExpr ¶
func (*TypeExpr) Copy ¶
func (e *TypeExpr) Copy() ExpressionInterface
func (*TypeExpr) GetAbraSite ¶
type ValueExpr ¶
type ValueExpr struct {
ExpressionBase
TritValue Trits
}
func NewValueExpr ¶
func NewValueExpr(t Trits) *ValueExpr
func (*ValueExpr) Copy ¶
func (e *ValueExpr) Copy() ExpressionInterface
func (*ValueExpr) GetAbraSite ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.