Documentation
¶
Index ¶
- type AST
- func (ast *AST) ReadAssign(token []Token) error
- func (ast *AST) ReadCall(token []Token) error
- func (ast *AST) ReadControl(token []Token) error
- func (ast *AST) ReadExpr(token []Token) error
- func (ast *AST) ReadFlow(token []Token) error
- func (ast *AST) ReadFunc(token []Token) error
- func (ast *AST) Write(indent int) string
- type Assembler
- type CLiteral
- type CTree
- type Compiler
- type KVM
- type Parser
- type Token
- type Vunit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AST ¶
type AST struct {
Value string // value, name
Vtype string // literal(6) name bicalc innercall outercall assign function control
Sub []AST // limited size subtree
}
AST - literal, allocator, func call, bicalc, structures (part 3)
func (*AST) ReadAssign ¶
read variable assign tokens -> one AST token (assign)
func (*AST) ReadControl ¶
read control tokens (if while for return) -> one AST token (control)
func (*AST) ReadExpr ¶
read one expression / series of tokens -> one AST value (literal(6) name bicalc innercall outercall)
type Assembler ¶
type Assembler struct {
Icon []byte // ksc5 icon
Info string // program name & info
ABIf int // ABI format
// contains filtered or unexported fields
}
kasm to kelf (part 5)
type CLiteral ¶
type CLiteral struct {
Vtype string // none bool int float string bytes
Vpos int // rodata position
Ivalue interface{} // bool/int/float/string/bytes
}
ctree literal value (part 4.5 ~ 4.6)
type CTree ¶
type CTree struct {
Value string // string formatted value
Vtype string // literal name bicalc innercall outercall assign function control
Sub []CTree // optimized sub component
Ivalue *CLiteral // immediate value (literal only)
}
optimized compile tree (part 4.7 ~ 4.9)
type Compiler ¶
type Compiler struct {
OptConst bool // fold literal ! manual init !
OptAsm bool // use shortcode ! manual init !
OuterNum map[string]int // outercall interupt code (32+) ! manual init !
OuterParms map[string]int // outercall [funcname]parms num ! manual init !
InnerNum map[string]int // innercall jmp num
InnerParms map[string]int // innercall [funcname]parms num
InnerLocal map[string]int // innercall [funcname]localvar num (include argnum)
VarGlobal map[string]int // global [varname]pos
VarLocal map[string]int // local [varname]pos ! need init !
VarArgs int // function args num ! need init !
CountLocal int // function localvar counter ! need init !
CountLabel int // jmp label counter
CountFor int // fornum counter
CountLiteral map[string]CLiteral // [type + strf]value, (none true false 0 1 0.0 s"" b” ...)
// contains filtered or unexported fields
}
AST -> CTree -> kasm (part 4.0 ~ 4.4)
type KVM ¶
type KVM struct {
CallMem []Vunit // outercall args
SafeMem bool // safe memory access
RunOne bool // run only 1 cycle
ErrHlt bool // halt if error
ErrMsg string // runtime error msg
MaxStk int // stack max size
// contains filtered or unexported fields
}
kscript virtual machine (part 7)
type Parser ¶
type Parser struct {
Type_Allocator []string // memory allocator
Type_Control []string // control syntax
Type_Operator []string // operator syntax
Type_Function []string // basic function
Sign_Bracket []string // bracket with pair
Sign_Blank []string // whitespace characters
Sign_Linefeed []string // newline characters
Sign_Comma []string // comma characters
Sign_Comment []string // comment characters
Result_String []string // string values
Result_Type []string // type of words
}
syntax parser (part 1)
type Token ¶
type Token struct {
Value string // string formed value
Vtype string // expression newline allocator operator control basefunc none bool int float string bytes name
Lower []Token // lower tokens
}
token without bracket (part 2)
type Vunit ¶
type Vunit struct {
Vtype byte // 0 : none, 1 : bool, 2 : int, 3 : float, 4 : string, 5 : bytes
Vbool bool // bool
Vint int // int
Vfloat float64 // float
Vstring string // string
Vbytes []byte // bytes
}
variable unit (part 6)
Click to show internal directories.
Click to hide internal directories.