Versions in this module Expand all Collapse all v0 v0.1.6 May 23, 2022 v0.1.5 Jun 27, 2021 v0.1.4 Jan 6, 2021 v0.1.3 Dec 13, 2019 v0.1.2 Oct 13, 2019 v0.1.1 Sep 13, 2019 v0.1.0 Sep 12, 2019 Changes in this version + func CompileExp(c *ir.Compiler, e ExpNode) ir.Register + func CompileExpInto(c *ir.Compiler, e ExpNode, dst ir.Register) + func CompileExpList(c *ir.Compiler, exps []ExpNode, dstRegs []ir.Register) + func EmitInstr(c *ir.Compiler, l Locator, instr ir.Instruction) + func EmitJump(c *ir.Compiler, l Locator, lbl ir.Name) + func EmitLoadConst(c *ir.Compiler, l Locator, k ir.Constant, reg ir.Register) + func EmitMove(c *ir.Compiler, l Locator, dst, src ir.Register) + func IsNumber(e ExpNode) bool + type Assign func(ir.Register) + type AssignStat struct + Dest []Var + Src []ExpNode + func NewAssignStat(dst []Var, src []ExpNode) AssignStat + func NewFunctionStat(fName Var, method Name, fx Function) AssignStat + func (s AssignStat) CompileStat(c *ir.Compiler) + func (s AssignStat) HWrite(w HWriter) + type BFunctionCall struct + func (f BFunctionCall) CompileCall(c *ir.Compiler, tail bool) + func (f BFunctionCall) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (f BFunctionCall) HWrite(w HWriter) + type BinOp struct + func NewBinOp(left ExpNode, op ops.Op, right ExpNode) *BinOp + func (b *BinOp) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (b *BinOp) HWrite(w HWriter) + type BlockStat struct + Return []ExpNode + Stats []Stat + func NewBlockStat(stats []Stat, rtn []ExpNode) BlockStat + func (s BlockStat) CompileBlock(c *ir.Compiler) + func (s BlockStat) CompileBlockNoPop(c *ir.Compiler) func() + func (s BlockStat) CompileChunk(source string) *ir.Compiler + func (s BlockStat) CompileStat(c *ir.Compiler) + func (s BlockStat) HWrite(w HWriter) + type Bool struct + Val bool + func False(tok *token.Token) Bool + func True(tok *token.Token) Bool + func (b Bool) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (b Bool) HWrite(w HWriter) + type BreakStat struct + func NewBreakStat(tok *token.Token) BreakStat + func (s BreakStat) CompileStat(c *ir.Compiler) + func (s BreakStat) HWrite(w HWriter) + type CondStat struct + Body BlockStat + Cond ExpNode + func (s CondStat) CompileCond(c *ir.Compiler, lbl ir.Label) + func (s CondStat) HWrite(w HWriter) + type EmptyStat struct + func NewEmptyStat(tok *token.Token) EmptyStat + func (s EmptyStat) CompileStat(c *ir.Compiler) + func (s EmptyStat) HWrite(w HWriter) + type EtcType struct + func Etc(tok *token.Token) EtcType + func (e EtcType) CompileEtcExp(c *ir.Compiler, dst ir.Register) ir.Register + func (e EtcType) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (e EtcType) CompileTailExp(c *ir.Compiler, dstRegs []ir.Register) + func (e EtcType) HWrite(w HWriter) + type ExpNode interface + CompileExp func(*ir.Compiler, ir.Register) ir.Register + func NewNumber(id *token.Token) (ExpNode, error) + func NewStringArgs(id *token.Token) ([]ExpNode, error) + type Float struct + func NewFloat(x float64) Float + func (f Float) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (f Float) HWrite(w HWriter) + func (f Float) Val() float64 + type ForInStat struct + Body BlockStat + Params []ExpNode + Vars []Name + func NewForInStat(startTok, endTok *token.Token, itervars []Name, params []ExpNode, ...) *ForInStat + func (s *ForInStat) HWrite(w HWriter) + func (s ForInStat) CompileStat(c *ir.Compiler) + type ForStat struct + Body BlockStat + Start ExpNode + Step ExpNode + Stop ExpNode + Var Name + func NewForStat(startTok, endTok *token.Token, itervar Name, params []ExpNode, body BlockStat) *ForStat + func (s *ForStat) HWrite(w HWriter) + func (s ForStat) CompileStat(c *ir.Compiler) + type Function struct + Body BlockStat + Name string + func NewFunction(startTok, endTok *token.Token, parList ParList, body BlockStat) Function + func (f Function) CompileBody(c *ir.Compiler) + func (f Function) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (f Function) HWrite(w HWriter) + type FunctionCall struct + func NewFunctionCall(target ExpNode, method Name, args []ExpNode) FunctionCall + func (f FunctionCall) CompileEtcExp(c *ir.Compiler, dst ir.Register) ir.Register + func (f FunctionCall) CompileStat(c *ir.Compiler) + func (f FunctionCall) CompileTailExp(c *ir.Compiler, dstRegs []ir.Register) + func (f FunctionCall) InBrackets() *BFunctionCall + type GotoStat struct + Label Name + func NewGotoStat(gotoTok *token.Token, lbl Name) GotoStat + func (s GotoStat) CompileStat(c *ir.Compiler) + func (s GotoStat) HWrite(w HWriter) + type HWriter interface + Dedent func() + Indent func() + Next func() + Writef func(string, ...interface{}) + type IfStat struct + Else *BlockStat + ElseIfs []CondStat + If CondStat + func NewIfStat(endTok *token.Token) IfStat + func (s IfStat) AddElse(endTok *token.Token, body BlockStat) IfStat + func (s IfStat) AddElseIf(cond ExpNode, body BlockStat) IfStat + func (s IfStat) AddIf(ifTok *token.Token, cond ExpNode, body BlockStat) IfStat + func (s IfStat) CompileStat(c *ir.Compiler) + func (s IfStat) HWrite(w HWriter) + type IndentWriter struct + func NewIndentWriter(w io.Writer) *IndentWriter + func (w *IndentWriter) Dedent() + func (w *IndentWriter) Indent() + func (w *IndentWriter) Next() + func (w *IndentWriter) Writef(f string, args ...interface{}) + type IndexExp struct + Coll ExpNode + Idx ExpNode + func NewIndexExp(coll ExpNode, idx ExpNode) IndexExp + func (e IndexExp) CompileAssign(c *ir.Compiler) Assign + func (e IndexExp) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (e IndexExp) FunctionName() string + func (e IndexExp) HWrite(w HWriter) + type Int struct + func NewInt(val uint64) Int + func (n Int) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (n Int) HWrite(w HWriter) + func (n Int) Val() uint64 + type LabelStat struct + func NewLabelStat(label Name) LabelStat + func (s LabelStat) CompileStat(c *ir.Compiler) + func (s LabelStat) HWrite(w HWriter) + type LocalFunctionStat struct + Name Name + func NewLocalFunctionStat(name Name, fx Function) LocalFunctionStat + func (s LocalFunctionStat) CompileStat(c *ir.Compiler) + func (s LocalFunctionStat) HWrite(w HWriter) + type LocalStat struct + Names []Name + Values []ExpNode + func NewLocalStat(names []Name, values []ExpNode) LocalStat + func (s LocalStat) CompileStat(c *ir.Compiler) + func (s LocalStat) HWrite(w HWriter) + type Location struct + func LocFromToken(tok *token.Token) Location + func LocFromTokens(t1, t2 *token.Token) Location + func MergeLocations(l1, l2 Locator) Location + func (l Location) EndPos() *token.Pos + func (l Location) Locate() Location + func (l Location) StartPos() *token.Pos + type Locator interface + Locate func() Location + type Name struct + Val string + func NewName(id *token.Token) Name + func (n Name) AstString() String + func (n Name) CompileAssign(c *ir.Compiler) Assign + func (n Name) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (n Name) FunctionName() string + func (n Name) HWrite(w HWriter) + type NilType struct + func Nil(tok *token.Token) NilType + func (n NilType) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (n NilType) HWrite(w HWriter) + type NoTableKey struct + func (k NoTableKey) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (k NoTableKey) HWrite(w HWriter) + type Node interface + HWrite func(w HWriter) + type NumberOracle interface + IsNumber func() bool + type ParList struct + HasDots bool + Params []Name + func NewParList(params []Name, hasDots bool) ParList + type RepeatStat struct + func NewRepeatStat(repTok *token.Token, body BlockStat, cond ExpNode) RepeatStat + func (s RepeatStat) CompileStat(c *ir.Compiler) + func (s RepeatStat) HWrite(w HWriter) + type Stat interface + CompileStat func(c *ir.Compiler) + type String struct + Val []byte + func NewLongString(id *token.Token) String + func NewString(id *token.Token) (ss String, err error) + func (s String) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (s String) HWrite(w HWriter) + type TableConstructor struct + Fields []TableField + func NewTableConstructor(opTok, clTok *token.Token, fields []TableField) TableConstructor + func (c TableConstructor) HWrite(w HWriter) + func (t TableConstructor) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + type TableField struct + Key ExpNode + Value ExpNode + func NewTableField(key ExpNode, value ExpNode) TableField + type TailExpNode interface + CompileEtcExp func(*ir.Compiler, ir.Register) ir.Register + CompileTailExp func(*ir.Compiler, []ir.Register) + type UnOp struct + Op ops.Op + Operand ExpNode + func NewUnOp(opTok *token.Token, op ops.Op, exp ExpNode) *UnOp + func (u *UnOp) CompileExp(c *ir.Compiler, dst ir.Register) ir.Register + func (u *UnOp) HWrite(w HWriter) + type Var interface + CompileAssign func(*ir.Compiler) Assign + FunctionName func() string + type WhileStat struct + func NewWhileStat(whileTok, endTok *token.Token, cond ExpNode, body BlockStat) WhileStat + func (s WhileStat) CompileStat(c *ir.Compiler) + func (s WhileStat) HWrite(w HWriter)