summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-11-26 16:24:34 -0500
committerKyle Gunger <kgunger12@gmail.com>2023-11-26 16:24:34 -0500
commit5e95512faaf00c4de6b32770080de7e8d4210e62 (patch)
treec323efcf3f54b843998c35247e9172333299f074
parent2ac6807d25e6f5696dcf0e7b2e360e99286863a5 (diff)
Token struct
-rw-r--r--compiler.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler.c b/compiler.c
index a3e6957..7d5ae5d 100644
--- a/compiler.c
+++ b/compiler.c
@@ -358,6 +358,31 @@ typedef struct {
// Whatev
+// Tokenizer
+typedef struct {
+ char *data;
+ int line, col;
+ int type;
+} Token;
+
+#define TT_DEFWORD 0
+#define TT_KEYWORD 1
+#define TT_KEYTYPE 2
+#define TT_LITERAL 3
+#define TT_AUGMENT 4
+#define TT_DELIMIT 5
+#define TT_SPLITTR 6
+
+char *KEYWORDS = "module,export,asm,if,else,loop,label,goto,continue,break,return,import,as,using,struct,method,interface,implements,operator,len,is";
+char *KEYTYPES = "uint8,uint16,uint32,uint64,uint,int8,int16,int32,int64,int,float32,float64,float,comp64,comp,bool,vect,void,type";
+char *RESERVED = "~`!@#$%^&*()[]{}+-=\"\'\\|:;/?>.<,";
+char *MULTI_DELIMS = ";:#";
+
+int token_type(char*data) {
+ return TT_DEFWORD;
+}
+
+
void help() {
printf("\n");
printf("Usage:\n");