aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-05 00:57:20 -0500
committerMustafa Quraish <[email protected]>2022-02-05 08:56:15 -0500
commit24dd666121e2786efb82854b05aa71d759e04ee6 (patch)
tree4420eda5e1cde0bfe7dfe8f4b160212d59ceeca3 /src/parser.c
parentAdd `void` type and allow void* to be assigned to other ptr types (diff)
downloadcup-24dd666121e2786efb82854b05aa71d759e04ee6.tar.xz
cup-24dd666121e2786efb82854b05aa71d759e04ee6.zip
Add ability to initialize global variables
The code to initialize them is put right before calling `main()`
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c
index 49c9689..81c90da 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -375,9 +375,6 @@ Node *parse_var_declaration(Lexer *lexer)
}
if (token.type == TOKEN_ASSIGN) {
- if (is_global)
- die_location(token.loc, "Cannot initialize global variable `%s` outside function", node->var_decl.var.name);
-
node->var_decl.value = parse_expression(lexer);
if (is_missing_type) {