Documentation
¶
Index ¶
- Constants
- Variables
- func ExecAndGetExitCode(compilerPath string, in string) int
- func Gen(node *Node)
- func GenFizzBuzz(in int) string
- func GenStmt() (int, [2]string, map[string]interface{})
- func Generate(nodes []*Node) string
- type DefString
- type Line
- type LineKind
- type LocalVariable
- type Node
- func NewNode(kind NodeKind, lhs *Node, rhs *Node) *Node
- func NewNodeBlock(code []*Node) *Node
- func NewNodeCALL(functionName []rune, args []*Node) *Node
- func NewNodeFunction(name []rune, args []*Node, block *Node) *Node
- func NewNodeLVar(offset int) *Node
- func NewNodeNum(val int) *Node
- func NewNodeWithExpr(Kind NodeKind, init, cond, loop, lhs, rhs *Node) *Node
- func Parse(tok *Token) []*Node
- type NodeKind
- type Token
- type TokenKind
Constants ¶
View Source
const ( SourceCode = iota Comment Separator )
View Source
const ( NdADD = iota // + NdSUB // - NdMUL // * NdDIV // / NdEQ // == NdNE //!= NdLT // < NdLE // <= NdAND // && NdOR // || NdASSIGN // = NdNUM // 数字 NdLVAR // Local VAR NdCALL NdRETURN NdIF // NdIFELSE // NdWHILE NdFOR NdBLOCK // "{" stmt* "}" NdFUNCTION )
View Source
const ( TkRESERVED = iota TkNUM TkIDENT TkRETURN TkIF TkELSE TkWHILE TkFOR TkEOF )
Variables ¶
View Source
var Assembly []*Line
Functions ¶
func ExecAndGetExitCode ¶
Types ¶
type DefString ¶
type DefString struct {
// contains filtered or unexported fields
}
func NewDefString ¶
type Line ¶
type Line struct {
Kind LineKind
Body string
Comment string
ExtendNL int
BlockId string
BlockSeparator string
Nest int
Data string
}
func NewComment ¶
func NewSrcLine ¶
type LocalVariable ¶
type LocalVariable struct {
// contains filtered or unexported fields
}
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func NewNodeBlock ¶
func NewNodeCALL ¶
func NewNodeLVar ¶
func NewNodeNum ¶
func NewNodeWithExpr ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.