feat: parser + AST (Phase 1)

This commit is contained in:
2026-05-30 21:19:43 +03:00
parent 1b708ec755
commit 713ab8e4d6
6 changed files with 1598 additions and 7 deletions
+5
View File
@@ -11,6 +11,7 @@ type
##Identifiers
tkIdent # foo Bar _x
tkUnderscore # _
##Control flow keywords
tkIf # if
@@ -47,6 +48,7 @@ type
tkNull # null
tkSelf # self
tkSuper # super
tkSizeOf # sizeof
##Punctuation
tkLParen # (
@@ -191,6 +193,7 @@ proc keywordKind*(text: string): TokenKind =
of "null": tkNull
of "self": tkSelf
of "super": tkSuper
of "sizeof": tkSizeOf
of "true", "false": tkBoolLiteral
else: tkIdent
@@ -202,6 +205,8 @@ proc tokenKindName*(kind: TokenKind): string =
of tkCharLiteral: "char literal"
of tkBoolLiteral: "boolean literal"
of tkIdent: "identifier"
of tkUnderscore: "'_'"
of tkSizeOf: "'sizeof'"
of tkIf: "'if'"
of tkElse: "'else'"
of tkWhile: "'while'"