From a54831a979b6d1c30d063105724f24931ef03f59 Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Thu, 16 Apr 2026 17:20:19 +0100 Subject: [PATCH] feat: tokenizer scaffolding --- internal/tokenizer.go | 17 +++++++++++++++++ main.go | 25 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 internal/tokenizer.go create mode 100644 main.go diff --git a/internal/tokenizer.go b/internal/tokenizer.go new file mode 100644 index 0000000..cec6e33 --- /dev/null +++ b/internal/tokenizer.go @@ -0,0 +1,17 @@ +package tokenizer + +type TokenType int + +const ( + KEYWORD TokenType = iota + SYMBOL + INT_CONST + STR_CONST + IDENTIFIER +) + +type Token struct { + Value string + Type TokenType +} + diff --git a/main.go b/main.go new file mode 100644 index 0000000..c842358 --- /dev/null +++ b/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "os" + "regexp" +) + +func process(Path string) { + fmt.Println(Path) +} + +func main() { + args := os.Args + + if len(args) != 2 { + panic("You must provide a path for a Jack file or a directory that contains Jack files to compile!") + } + + Path := args[1] + + if match, _ := regexp.MatchString(".+\\.jack", Path); match { + process(Path) + } +}