reorder built-ins a bit
This commit is contained in:
parent
4727312da4
commit
241470248b
9
main.go
9
main.go
@ -30,9 +30,12 @@ func main() {
|
|||||||
// word definitions
|
// word definitions
|
||||||
dict.AddWord(":", Word{Name: ":", Impl: b.Colon(&c)})
|
dict.AddWord(":", Word{Name: ":", Impl: b.Colon(&c)})
|
||||||
dict.AddWord(";", Word{Name: ";", Impl: b.Semicolon(&c), Immediate: true})
|
dict.AddWord(";", Word{Name: ";", Impl: b.Semicolon(&c), Immediate: true})
|
||||||
// comments
|
// comments and strings
|
||||||
dict.AddWord("(", Word{Name: "(", Impl: b.OpenComment(&c), Immediate: true})
|
dict.AddWord("(", Word{Name: "(", Impl: b.OpenComment(&c), Immediate: true})
|
||||||
dict.AddWord(")", Word{Name: ")", Impl: b.CloseComment(&c), Immediate: true})
|
dict.AddWord(")", Word{Name: ")", Impl: b.CloseComment(&c), Immediate: true})
|
||||||
|
dict.AddWord(`."`, Word{Name: `."`, Impl: b.OpenQuote(os.Stdout, &rstack, '"')})
|
||||||
|
dict.AddWord(`"`, Word{Name: `"`, Impl: b.CloseQuote(&c)})
|
||||||
|
dict.AddWord(`.(`, Word{Name: `.(`, Impl: b.OpenQuote(os.Stdout, &rstack, ')'), Immediate: true})
|
||||||
// math
|
// math
|
||||||
dict.AddWord("+", Word{Name: "+", Impl: b.Add(&stack)})
|
dict.AddWord("+", Word{Name: "+", Impl: b.Add(&stack)})
|
||||||
dict.AddWord("-", Word{Name: "-", Impl: b.Sub(&stack)})
|
dict.AddWord("-", Word{Name: "-", Impl: b.Sub(&stack)})
|
||||||
@ -50,10 +53,6 @@ func main() {
|
|||||||
dict.AddWord(".", Word{Name: ".", Impl: b.Print(os.Stdout, &stack)})
|
dict.AddWord(".", Word{Name: ".", Impl: b.Print(os.Stdout, &stack)})
|
||||||
dict.AddWord("EMIT", Word{Name: "EMIT", Impl: b.Emit(os.Stdout, &stack)})
|
dict.AddWord("EMIT", Word{Name: "EMIT", Impl: b.Emit(os.Stdout, &stack)})
|
||||||
dict.AddWord("CR", Word{Name: "CR", Source: []string{"10", "EMIT"}}) // emit a newline
|
dict.AddWord("CR", Word{Name: "CR", Source: []string{"10", "EMIT"}}) // emit a newline
|
||||||
// strings
|
|
||||||
dict.AddWord(`."`, Word{Name: `."`, Impl: b.OpenQuote(os.Stdout, &rstack, '"')})
|
|
||||||
dict.AddWord(`"`, Word{Name: `"`, Impl: b.CloseQuote(&c)})
|
|
||||||
dict.AddWord(`.(`, Word{Name: `.(`, Impl: b.OpenQuote(os.Stdout, &rstack, ')'), Immediate: true})
|
|
||||||
// logic
|
// logic
|
||||||
dict.AddWord("=", Word{Name: "=", Impl: b.Eq(&stack)})
|
dict.AddWord("=", Word{Name: "=", Impl: b.Eq(&stack)})
|
||||||
dict.AddWord("0=", Word{Name: "0=", Source: []string{"0", "="}})
|
dict.AddWord("0=", Word{Name: "0=", Source: []string{"0", "="}})
|
||||||
|
Loading…
Reference in New Issue
Block a user