1 #ifndef MLR_DSL_BLOCKED_AST_H
2 #define MLR_DSL_BLOCKED_AST_H
3 
4 #include "dsl/mlr_dsl_ast.h"
5 #include "containers/sllv.h"
6 
7 // ================================================================
8 // The Lemon parser produces a single raw abstract syntax tree.  This container
9 // simply has the subtrees organized by top-level statement blocks. This is just
10 // a minor reorganization but it makes stack allocation and CST-builds simpler.
11 // ================================================================
12 
13 typedef struct _blocked_ast_t {
14 	sllv_t* pfunc_defs;
15 	sllv_t* psubr_defs;
16 	sllv_t* pbegin_blocks;
17 	mlr_dsl_ast_node_t* pmain_block;
18 	sllv_t* pend_blocks;
19 } blocked_ast_t;
20 
21 // This strips nodes off the raw AST and transfers them to the block-structured AST.
22 blocked_ast_t* blocked_ast_alloc(mlr_dsl_ast_t* past);
23 void blocked_ast_free(blocked_ast_t* paast);
24 
25 #endif // MLR_DSL_BLOCKED_AST_H
26