-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (33 loc) · 831 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"os"
"github.com/Luisgustavom1/go-language-scheme/core/interpreter"
"github.com/Luisgustavom1/go-language-scheme/core/lexer"
"github.com/Luisgustavom1/go-language-scheme/core/parser"
)
func main() {
lc := lexer.NewLexingContext(os.Args[1])
tokens := lc.Lexer()
var parseIndex int
var ast = parser.Ast{
{
Kind: parser.LiteralValue,
Literal: &lexer.Token{Value: "begin"},
},
}
for parseIndex < len(tokens) {
childAst, nextIndex := parser.Parse(tokens, parseIndex)
ast = append(ast, parser.AstValue{
Kind: parser.ListValue,
List: &childAst,
})
parseIndex = nextIndex
}
// Optimizations
// Type checking
// Are made in this step, over the AST
interpreter.InitializeBuiltIns()
value := interpreter.InitAstWalk(ast, map[string]any{})
fmt.Println(value)
}