about summary refs log tree commit diff
path: root/cmd/lang
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-08-11 01:25:47 +0000
committerMel <einebeere@gmail.com>2022-08-11 01:25:47 +0000
commit86f31acf6789be116dcc54ed85b069a37c0f7aa8 (patch)
treebc7afd6a8c340825996d29c6cfd392ae42b4fbd5 /cmd/lang
parentc46b2bc7ce6df1f2c6c9494ef08015ec29992da5 (diff)
downloadjinx-86f31acf6789be116dcc54ed85b069a37c0f7aa8.tar.zst
jinx-86f31acf6789be116dcc54ed85b069a37c0f7aa8.zip
Actual modules and core
Diffstat (limited to 'cmd/lang')
-rw-r--r--cmd/lang/main.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/cmd/lang/main.go b/cmd/lang/main.go
index 0a8eee8..f5046a7 100644
--- a/cmd/lang/main.go
+++ b/cmd/lang/main.go
@@ -7,7 +7,6 @@ import (
 	"jinx/pkg/lang/parser"
 	"jinx/pkg/lang/scanner"
 	"jinx/pkg/lang/vm"
-	"jinx/pkg/lang/vm/code"
 	"os"
 )
 
@@ -32,8 +31,6 @@ func main() {
 	}
 	defer file.Close()
 
-	var bc code.Code
-
 	scanner := scanner.New(file)
 	tokens, err := scanner.Scan()
 	if err != nil {
@@ -46,8 +43,8 @@ func main() {
 		exit("error during parsing: %v", err)
 	}
 
-	comp := compiler.New(program)
-	bc, err = comp.Compile()
+	comp := compiler.New("program", "noone", program)
+	module, err := comp.Compile()
 	if err != nil {
 		exit("compilation failed: %v", err)
 	}
@@ -59,13 +56,13 @@ func main() {
 		}
 		defer output.Close()
 
-		if _, err := output.Write(bc.Code()); err != nil {
+		if _, err := output.Write(module.Code().Code()); err != nil {
 			exit("could not write to file: %v", err)
 		}
 	}
 
 	if *run {
-		vm := vm.New(&bc, nil)
+		vm := vm.New(module)
 		if err := vm.Run(); err != nil {
 			exit("execution failed: %v", err)
 		}