aboutsummaryrefslogtreecommitdiff
path: root/compiler/parser.cup
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser.cup')
-rw-r--r--compiler/parser.cup8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/parser.cup b/compiler/parser.cup
index 914c4e6..40df5a3 100644
--- a/compiler/parser.cup
+++ b/compiler/parser.cup
@@ -54,6 +54,7 @@ fn find_function_definition(token: Token*): Node* {
fn identifier_exists(token: Token*): int {
if (find_local_variable(token)) return true;
if (find_function_definition(token)) return true;
+ if (find_builtin_function(token)) return true;
return false;
}
@@ -160,6 +161,11 @@ fn parse_identifier(lexer: Lexer*): Node* {
return parse_function_call_args(lexer, func);
}
+ func = find_builtin_function(&token);
+ if (func != null) {
+ return parse_function_call_args(lexer, func);
+ }
+
die_loc2(&token.loc, "Unknown identifier in parse_identifier: ", token.value.as_string);
}
@@ -642,6 +648,8 @@ fn parse_function(lexer: Lexer*): Node* {
}
fn parse_program(lexer: Lexer*): Node* {
+ initialize_builtins();
+
let node = node_new(AST_PROGRAM);
node.d.block.children = vector_new();