Documentation
¶
Index ¶
- Constants
- func NewCode(namespace, storage string) interfaces.IRCode
- func NewFunction(name string, code interfaces.IRCode) interfaces.Function
- func OptimizeFunctionBody(f interfaces.Function) interfaces.Function
- type Code
- func (c *Code) AddInstruction(inst interfaces.Instruction) interfaces.IRCode
- func (c *Code) AppendCopy(listPath, valuePath string) interfaces.IRCode
- func (c *Code) AppendSet(listPath string, value nbt.Value) interfaces.IRCode
- func (c *Code) Branch(branchName, funcName string) interfaces.IRCode
- func (c *Code) Call(funcName string) interfaces.IRCode
- func (c *Code) CallWithArgs(funcName, argPath string) interfaces.IRCode
- func (c *Code) Copy(from, to string) interfaces.IRCode
- func (c *Code) CopyArg(varName, funcName, argName string) interfaces.IRCode
- func (c *Code) CopyVar(from, to string) interfaces.IRCode
- func (c *Code) DoubleAcos(x, to string) interfaces.IRCode
- func (c *Code) DoubleAdd(x, y, to string) interfaces.IRCode
- func (c *Code) DoubleAsin(x, to string) interfaces.IRCode
- func (c *Code) DoubleAtan(x, to string) interfaces.IRCode
- func (c *Code) DoubleAtan2(x, y, to string) interfaces.IRCode
- func (c *Code) DoubleCeil(x, to string) interfaces.IRCode
- func (c *Code) DoubleCompare(regRa, regRb string, operator interfaces.TokenType, res string) interfaces.IRCode
- func (c *Code) DoubleCos(x, to string) interfaces.IRCode
- func (c *Code) DoubleDiv(x, y, to string) interfaces.IRCode
- func (c *Code) DoubleFloor(x, to string) interfaces.IRCode
- func (c *Code) DoubleMod(x, y, to string) interfaces.IRCode
- func (c *Code) DoubleMul(x, y, to string) interfaces.IRCode
- func (c *Code) DoubleRound(x, to string) interfaces.IRCode
- func (c *Code) DoubleSin(x, to string) interfaces.IRCode
- func (c *Code) DoubleSqrt(x, to string) interfaces.IRCode
- func (c *Code) DoubleSub(x, y, to string) interfaces.IRCode
- func (c *Code) DoubleTan(x, to string) interfaces.IRCode
- func (c *Code) ExceptionFormat(messageParts ...nbt.Value) interfaces.IRCode
- func (c *Code) ExceptionString(message string) interfaces.IRCode
- func (c *Code) Exec(mcCommand string) interfaces.IRCode
- func (c *Code) ExecReg(varName string) interfaces.IRCode
- func (c *Code) Extend(code interfaces.IRCode) interfaces.IRCode
- func (c *Code) Func(name string) interfaces.IRCode
- func (c *Code) GetInstructions() []interfaces.Instruction
- func (c *Code) GetNamespace() string
- func (c *Code) GetStorage() string
- func (c *Code) If(condVar string, code interfaces.IRCode) interfaces.IRCode
- func (c *Code) IntAdd(x, y, to string) interfaces.IRCode
- func (c *Code) IntCompare(regRa, regRb string, operator interfaces.TokenType, res string) interfaces.IRCode
- func (c *Code) IntDiv(x, y, to string) interfaces.IRCode
- func (c *Code) IntMod(x, y, to string) interfaces.IRCode
- func (c *Code) IntMul(x, y, to string) interfaces.IRCode
- func (c *Code) IntSub(x, y, to string) interfaces.IRCode
- func (c *Code) Len() int
- func (c *Code) Load(path, score string) interfaces.IRCode
- func (c *Code) MakeIndex(valuePath, res string) interfaces.IRCode
- func (c *Code) MathOp(operator string) interfaces.IRCode
- func (c *Code) PathDelete(obj, path string) interfaces.IRCode
- func (c *Code) PathGet(obj, path, to string) interfaces.IRCode
- func (c *Code) PathSet(obj, path, valuePath string) interfaces.IRCode
- func (c *Code) Raw(mcCommand string) interfaces.IRCode
- func (c *Code) Remove(path string) interfaces.IRCode
- func (c *Code) RemoveArg(funcName, argName string) interfaces.IRCode
- func (c *Code) RemoveVar(name string) interfaces.IRCode
- func (c *Code) Ret() interfaces.IRCode
- func (c *Code) Score(target string, score *nbt.Int) interfaces.IRCode
- func (c *Code) Set(path string, value nbt.Value) interfaces.IRCode
- func (c *Code) SetArg(funcName, argName string, value nbt.Value) interfaces.IRCode
- func (c *Code) SetArgs(funcName string, value nbt.Compound) interfaces.IRCode
- func (c *Code) SetInstructions(instructions []interfaces.Instruction)
- func (c *Code) SetVar(name string, value nbt.Value) interfaces.IRCode
- func (c *Code) Size(source, res string) interfaces.IRCode
- func (c *Code) Store(score, path string) interfaces.IRCode
- func (c *Code) StringCompare(a, b, res string) interfaces.IRCode
- func (c *Code) StringConcat(a, b, res string) interfaces.IRCode
- func (c *Code) StringSlice(stringVar, startIndex, endIndex, res string) interfaces.IRCode
- func (c *Code) StructGet(structPath, field, dataPath string) interfaces.IRCode
- func (c *Code) StructSet(dataPath, field, structPath string) interfaces.IRCode
- func (c *Code) ToMCCode() string
- func (c *Code) ToString() string
- func (c *Code) Trace(name, path string) interfaces.IRCode
- func (c *Code) TraceArg(name, funcName, argName string) interfaces.IRCode
- func (c *Code) TraceScore(name, score string) interfaces.IRCode
- func (c *Code) TraceVar(name, varName string) interfaces.IRCode
- func (c *Code) Unless(condVar string, code interfaces.IRCode) interfaces.IRCode
- func (c *Code) XCopy(storageFrom, from, storageTo, to string) interfaces.IRCode
- func (c *Code) XLoad(path, score string) interfaces.IRCode
- func (c *Code) XRemove(storage, path string) interfaces.IRCode
- func (c *Code) XSet(storage, path string, value nbt.Value) interfaces.IRCode
- func (c *Code) XTrace(name, storage, path string) interfaces.IRCode
- type Function
- type Instruction
- type OptFunc
Constants ¶
View Source
const ( RX = "$RX" RA = "$RA" RB = "$RB" RET = "$RET" // Function return value RETF = "$RETF" // Early return flag CALL = "$CALL" VarPath = "vars" ArgPath = "args" StructPath = "structs" MaxCallCounter = 65536 )
View Source
const ( Set = "set" // `set <storage> <path> <value>` Copy = "copy" // `copy <storage from> <path from> <storage to> <path to>` Remove = "remove" // `remove <storage> <path>` Math = "math" // `math <operation>` Load = "load" // `load <path> <score>` Store = "store" // `store <score> <path>` Score = "score" // `score <target> <score>` AppendSet = "appendSet" // `appendSet <listPath> <value>` AppendCopy = "appendCopy" // `appendCopy <listPath> <valuePath>` Size = "size" // `size <source> <res>` Cmp = "cmp" // `cmp <score> <condition> <score>` If = "if" // `if <score> <instruction>` Unless = "unless" // `unless <score> <instruction>` Ret = "ret" // `ret` Func = "func" // `func <name>\n\t<code>` Call = "call" // `call <name> Branch = "branch" // `branch <name>` Raw = "raw" // `raw <command>` Trace = "trace" // `trace <storage> <path>` )
View Source
const ( TraceStorage = "storage" TraceScore = "score" )
Variables ¶
This section is empty.
Functions ¶
func NewCode ¶
func NewCode(namespace, storage string) interfaces.IRCode
func NewFunction ¶
func NewFunction(name string, code interfaces.IRCode) interfaces.Function
func OptimizeFunctionBody ¶
func OptimizeFunctionBody(f interfaces.Function) interfaces.Function
Types ¶
type Code ¶
type Code struct {
interfaces.IRCode
Instructions []interfaces.Instruction
Namespace string
// contains filtered or unexported fields
}
func (*Code) AddInstruction ¶
func (c *Code) AddInstruction(inst interfaces.Instruction) interfaces.IRCode
func (*Code) AppendCopy ¶
func (c *Code) AppendCopy(listPath, valuePath string) interfaces.IRCode
func (*Code) CallWithArgs ¶ added in v0.1.1
func (c *Code) CallWithArgs(funcName, argPath string) interfaces.IRCode
func (*Code) DoubleAcos ¶
func (c *Code) DoubleAcos(x, to string) interfaces.IRCode
func (*Code) DoubleAsin ¶
func (c *Code) DoubleAsin(x, to string) interfaces.IRCode
func (*Code) DoubleAtan ¶
func (c *Code) DoubleAtan(x, to string) interfaces.IRCode
func (*Code) DoubleAtan2 ¶
func (c *Code) DoubleAtan2(x, y, to string) interfaces.IRCode
func (*Code) DoubleCeil ¶
func (c *Code) DoubleCeil(x, to string) interfaces.IRCode
func (*Code) DoubleCompare ¶
func (c *Code) DoubleCompare(regRa, regRb string, operator interfaces.TokenType, res string) interfaces.IRCode
func (*Code) DoubleFloor ¶
func (c *Code) DoubleFloor(x, to string) interfaces.IRCode
func (*Code) DoubleRound ¶
func (c *Code) DoubleRound(x, to string) interfaces.IRCode
func (*Code) DoubleSqrt ¶
func (c *Code) DoubleSqrt(x, to string) interfaces.IRCode
func (*Code) ExceptionFormat ¶ added in v0.2.0
func (c *Code) ExceptionFormat(messageParts ...nbt.Value) interfaces.IRCode
func (*Code) ExceptionString ¶ added in v0.2.0
func (c *Code) ExceptionString(message string) interfaces.IRCode
func (*Code) Extend ¶
func (c *Code) Extend(code interfaces.IRCode) interfaces.IRCode
func (*Code) GetInstructions ¶
func (c *Code) GetInstructions() []interfaces.Instruction
func (*Code) GetNamespace ¶
func (*Code) GetStorage ¶
func (*Code) If ¶
func (c *Code) If(condVar string, code interfaces.IRCode) interfaces.IRCode
func (*Code) IntCompare ¶
func (c *Code) IntCompare(regRa, regRb string, operator interfaces.TokenType, res string) interfaces.IRCode
func (*Code) PathDelete ¶
func (c *Code) PathDelete(obj, path string) interfaces.IRCode
func (*Code) Ret ¶
func (c *Code) Ret() interfaces.IRCode
func (*Code) SetInstructions ¶
func (c *Code) SetInstructions(instructions []interfaces.Instruction)
func (*Code) StringCompare ¶
func (c *Code) StringCompare(a, b, res string) interfaces.IRCode
func (*Code) StringConcat ¶
func (c *Code) StringConcat(a, b, res string) interfaces.IRCode
func (*Code) StringSlice ¶
func (c *Code) StringSlice(stringVar, startIndex, endIndex, res string) interfaces.IRCode
func (*Code) StructGet ¶
func (c *Code) StructGet(structPath, field, dataPath string) interfaces.IRCode
func (*Code) StructSet ¶
func (c *Code) StructSet(dataPath, field, structPath string) interfaces.IRCode
func (*Code) TraceScore ¶
func (c *Code) TraceScore(name, score string) interfaces.IRCode
func (*Code) Unless ¶
func (c *Code) Unless(condVar string, code interfaces.IRCode) interfaces.IRCode
type Function ¶
type Function struct {
interfaces.Function
Name string
Code interfaces.IRCode
}
func (*Function) GetCode ¶
func (f *Function) GetCode() interfaces.IRCode
func (*Function) ToMCFunction ¶
type Instruction ¶
type Instruction struct {
interfaces.Instruction
Type interfaces.InstructionType
DPNamespace string
Storage string
Args []string
}
func (Instruction) GetArgs ¶
func (i Instruction) GetArgs() []string
func (Instruction) GetType ¶
func (i Instruction) GetType() interfaces.InstructionType
func (Instruction) ToMCCommand ¶
func (i Instruction) ToMCCommand() string
func (Instruction) ToString ¶
func (i Instruction) ToString() string
type OptFunc ¶
type OptFunc func(instrs []interfaces.Instruction, i int) (matched bool, consumed int, replacement []interfaces.Instruction)
Click to show internal directories.
Click to hide internal directories.