aboutsummaryrefslogtreecommitdiff
path: root/compiler/tokens.cup
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-06 01:18:39 -0500
committerMustafa Quraish <[email protected]>2022-02-06 01:18:39 -0500
commit108a59b91ca6263054ed0bf905df405f5f8bd3fb (patch)
tree35f4d55ba05b063977242ecc4bd7feaed216cfb0 /compiler/tokens.cup
parent[cup] Add support for global (initialized) variables (diff)
downloadcup-108a59b91ca6263054ed0bf905df405f5f8bd3fb.tar.xz
cup-108a59b91ca6263054ed0bf905df405f5f8bd3fb.zip
[cup] Flesh out some more boilerplate based on C implementation
No feature has really been fully added here, just fleshing out some more of the global variables / functions / conditions here so it's easier to implement them later on
Diffstat (limited to 'compiler/tokens.cup')
-rw-r--r--compiler/tokens.cup3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/tokens.cup b/compiler/tokens.cup
index e991610..cf1b011 100644
--- a/compiler/tokens.cup
+++ b/compiler/tokens.cup
@@ -57,6 +57,7 @@ enum TokenType {
TOKEN_INT,
TOKEN_LET,
TOKEN_RETURN,
+ TOKEN_SIZEOF,
TOKEN_STRUCT,
TOKEN_UNION,
TOKEN_VOID,
@@ -135,6 +136,7 @@ fn token_type_to_string(typ: int): char* {
if (typ == TOKEN_INT) return "TOKEN_INT";
if (typ == TOKEN_LET) return "TOKEN_LET";
if (typ == TOKEN_RETURN) return "TOKEN_RETURN";
+ if (typ == TOKEN_SIZEOF) return "TOKEN_SIZEOF";
if (typ == TOKEN_STRUCT) return "TOKEN_STRUCT";
if (typ == TOKEN_UNION) return "TOKEN_UNION";
if (typ == TOKEN_VOID) return "TOKEN_VOID";
@@ -157,6 +159,7 @@ fn keyword_to_string(typ: int): char* {
if (typ == TOKEN_INT) return "int";
if (typ == TOKEN_LET) return "let";
if (typ == TOKEN_RETURN) return "return";
+ if (typ == TOKEN_SIZEOF) return "sizeof";
if (typ == TOKEN_STRUCT) return "struct";
if (typ == TOKEN_UNION) return "union";
if (typ == TOKEN_VOID) return "void";