aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-01-10 22:59:41 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-01-10 23:01:35 +0200
commit2d90cea9adb9a3f73cd5b211a4ed9508b505729f (patch)
tree78f9cde6d162fbda9352d2c668ac00a298815b19 /include
parentdbf3ed3db10f9fa9157d661704e16ba5b73b0e84 (diff)
downloadek-2d90cea9adb9a3f73cd5b211a4ed9508b505729f.tar.gz
ek-2d90cea9adb9a3f73cd5b211a4ed9508b505729f.zip
initial struct continuations implemented
Diffstat (limited to 'include')
-rw-r--r--include/ek/ast.h5
-rw-r--r--include/ek/scope.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/include/ek/ast.h b/include/ek/ast.h
index 9107e8a..f8ffd8b 100644
--- a/include/ek/ast.h
+++ b/include/ek/ast.h
@@ -238,6 +238,7 @@ struct ast {
enum ast_flags f;
struct ast *n;
+ struct ast *chain;
struct src_loc loc;
struct scope *scope;
};
@@ -584,7 +585,7 @@ static inline bool is_primitive(struct type *t)
#define struct_cont_id(x) return_s(x, AST_STRUCT_CONT_DEF)
#define struct_cont_params(x) return_a0(x, AST_STRUCT_CONT_DEF)
#define struct_cont_behav(x) return_t1(x, AST_STRUCT_CONT_DEF)
-#define struct_cont_body(x) return_a2(x, AST_STRUCT_CONT_DEF)
+#define struct_cont_body(x) return_a1(x, AST_STRUCT_CONT_DEF)
#define gen_struct_cont(id, params, behav, body, loc) \
gen_ast(AST_STRUCT_CONT_DEF, params, body, NULL, NULL, behav, id, 0, \
loc)
@@ -744,4 +745,6 @@ struct type *reverse_type_list(struct type *root);
#define foreach_type(iter, nodes) \
for (struct type *iter = nodes; iter; iter = iter->n)
+struct ast *chain_base(struct ast *node);
+
#endif /* AST_H */
diff --git a/include/ek/scope.h b/include/ek/scope.h
index 3091388..e4c706a 100644
--- a/include/ek/scope.h
+++ b/include/ek/scope.h
@@ -178,6 +178,8 @@ int scope_add_var(struct scope *scope, struct ast *var);
*/
int scope_add_type(struct scope *scope, char *id, struct ast *type);
+int scope_add_chain(struct scope *scope, char *id, struct ast *node);
+
/**
* Add procedure to scope.
* Propagates public procedures up the file scope chain as references.
@@ -211,6 +213,9 @@ int scope_add_trait(struct scope *scope, struct ast *trait);
int scope_add_expd_struct(struct scope *scope, struct ast *def,
struct type *types, struct ast *expanded);
+int scope_add_expd_chain(struct scope *scope, struct ast *def,
+ struct type *types, struct ast *expanded);
+
/**
* Find a variable with ID in \p scope.
* @note Only looks in the current scope, so doesn't see anything outside