diff --git a/internal/parser/parser.go b/internal/compilation-engine/compilation-engine.go similarity index 100% rename from internal/parser/parser.go rename to internal/compilation-engine/compilation-engine.go diff --git a/main.go b/main.go index 849c342..9f3b95b 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "regexp" "strings" - "github.com/hazemKrimi/jack-compiler/internal/parser" + "github.com/hazemKrimi/jack-compiler/internal/compilation-engine" "github.com/hazemKrimi/jack-compiler/internal/tokenizer" ) @@ -26,7 +26,12 @@ func process(inputPath string) error { return err } - parsed := parser.ParseTokens(tokens) + parsed, err := parser.ParseTokens(tokens) + + if err != nil { + return err + } + outputPath := strings.Replace(inputPath, ".jack", ".xml", 1) if err := os.WriteFile(outputPath, []byte(parsed), 0644); err != nil {