feat: tokenizer scaffolding

This commit is contained in:
2026-04-16 17:20:19 +01:00
parent 4fd1edaaf7
commit a54831a979
2 changed files with 42 additions and 0 deletions
+17
View File
@@ -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
}
+25
View File
@@ -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)
}
}