diff options
| author | Michael Tews <git@tews.dev> | 2024-06-10 04:13:30 +0200 |
|---|---|---|
| committer | Michael Tews <git@tews.dev> | 2024-06-10 04:13:30 +0200 |
| commit | 0181ac9aa71b0f8b06fa50ae9d60fc003a72847f (patch) | |
| tree | 03b7185fb8926df1de3dc291af3e5d8c4ec2db0f | |
| parent | 528e82ec7835f7c681d2a961f3f2da2a833152db (diff) | |
feat: adds tokens
adds TokenType, Token and tokens
| -rw-r--r-- | token/token.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/token/token.go b/token/token.go new file mode 100644 index 0000000..92bc1ee --- /dev/null +++ b/token/token.go @@ -0,0 +1,34 @@ +package token + +const ( + ILLEGAL = "ILLEGAL" + EOF = "EOF" + + // Identifiers and literals + IDENT = "IDENT" + INT = "INT" + + // Operators + ASSIGN = "=" + PLUS = "+" + + // Delimiters + COMMA = "," + SEMICOLON = ";" + + LPAREN = "(" + RPAREN = ")" + LBRACE = "{" + RBRACE = "}" + + // Keywords + FUNCTION = "FUNCTION" + LET = "LET" +) + +type TokenType string + +type Token struct { + Type TokenType + Literal string +} |
