summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-11-26 16:25:04 -0500
committerKyle Gunger <kgunger12@gmail.com>2023-11-26 16:25:04 -0500
commite2c1a5b07de6260740bad4ed60b6035d94c441ae (patch)
tree58b21485ac62f970858b859e44c92457cfcdd52a
parent07f030063e23447abf695ac018f3f9d2d58493af (diff)
parent5e95512faaf00c4de6b32770080de7e8d4210e62 (diff)
Merge branch 'main' of git.cshift.net:CircleShift/ctc
-rw-r--r--compiler.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler.c b/compiler.c
index 754a655..de44994 100644
--- a/compiler.c
+++ b/compiler.c
@@ -457,6 +457,31 @@ void mod_deep_end(Module *mod) {
// 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");