summaryrefslogtreecommitdiff
path: root/ast.h
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2026-03-29 08:28:28 -1000
committerCarson Fleming <cflems@cflems.net>2026-03-29 08:28:28 -1000
commit7cf2065be92855b5b1db31a4bb7afbb4af29a817 (patch)
tree773e9df00d46934f548a2d76dbe6e61aec9b21c9 /ast.h
parent50495e8f815d3d5f92b3d36369acc52a6d2ea9c4 (diff)
downloadccc-7cf2065be92855b5b1db31a4bb7afbb4af29a817.tar.gz
calling functions and some optimizationsHEADmaster
Diffstat (limited to 'ast.h')
-rw-r--r--ast.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/ast.h b/ast.h
index 5ae0d12..2eabb02 100644
--- a/ast.h
+++ b/ast.h
@@ -1,6 +1,8 @@
#ifndef AST_H
#define AST_H
+#include "scope.h"
+
struct stmt_node;
struct expr_node;
@@ -8,8 +10,8 @@ struct type_node {
bool _unsigned;
bool _short;
bool _long;
+ struct type_def def;
unsigned char ptr_level;
- char* name;
};
struct int_lit_node {
@@ -56,6 +58,12 @@ struct assign_node {
struct expr_node* rval;
};
+struct call_node {
+ /* TODO: eventually this could also be a function pointer */
+ struct fn_decl_node* called_fn;
+ struct expr_node* args_head;
+};
+
struct expr_node {
enum {
EXPR_INT_LIT,
@@ -64,6 +72,7 @@ struct expr_node {
EXPR_STR_LIT,
EXPR_VAR_REF,
EXPR_ASSIGN,
+ EXPR_CALL,
} type;
union {
struct int_lit_node _int_lit;
@@ -72,7 +81,10 @@ struct expr_node {
struct str_lit_node _str_lit;
struct var_ref_node _var_ref;
struct assign_node _assign;
+ struct call_node _call;
} as;
+
+ struct expr_node* next;
};
struct group_node {