diff --git a/main.go b/main.go index 05c2d3e..e1b5689 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "os" "github.com/brettlangdon/gython/ast" + "github.com/brettlangdon/gython/compiler" "github.com/brettlangdon/gython/grammar" "github.com/brettlangdon/gython/scanner" "github.com/brettlangdon/gython/token" @@ -29,17 +30,25 @@ func parseGrammar() *grammar.FileInput { return gp.Parse() } -func parseAST() { +func parseAST() ast.Mod { start := parseGrammar() mod, err := ast.ASTFromGrammar(start) if err != nil { panic(err) } - fmt.Println(mod) + return mod +} + +func compile() { + root := parseAST() + codeobject := compiler.CompileAST(root) + fmt.Println(codeobject) } func main() { // start := parseGrammar() // fmt.Println(start.Repr()) - parseAST() + // root := parseAST() + // fmt.Println(root) + compile() }