13 AST_TYPE_TRANSLATION_UNIT,
17 AST_TYPE_LIST_OF_PARAMETERS,
19 AST_TYPE_FUNCTION_DEFINITION,
21 AST_TYPE_LIST_OF_ARGUMENTS,
22 AST_TYPE_FUNCTION_CALL,
28 AST_TYPE_MULTIPLICATION,
32 AST_TYPE_CONDITIONAL_BLOCK,
36 AST_TYPE_DATA_WRAPPER,
41#define AST_MAX_ARITY 16
51 AST_ERROR_CODE_INT_NODE_CREATION_FAILED,
52 AST_ERROR_CODE_STRING_NODE_CREATION_FAILED,
53 AST_ERROR_CODE_SYMBOL_NAME_NODE_CREATION_FAILED,
54 AST_ERROR_CODE_BINDING_NODE_CREATION_FAILED,
55 AST_ERROR_CODE_READING_NODE_CREATION_FAILED,
56 AST_ERROR_CODE_WRITING_NODE_CREATION_FAILED,
57 AST_ERROR_CODE_TRANSLATION_UNIT_NODE_CREATION_FAILED,
58 AST_ERROR_CODE_TRANSLATION_UNIT_APPEND_FAILED,
59 AST_ERROR_CODE_BLOCK_ITEMS_NODE_CREATION_FAILED,
60 AST_ERROR_CODE_BLOCK_ITEMS_APPEND_FAILED,
61 AST_ERROR_CODE_BLOCK_NODE_CREATION_FAILED,
62 AST_ERROR_CODE_PARAMETERS_NODE_CREATION_FAILED,
63 AST_ERROR_CODE_PARAMETERS_APPEND_FAILED,
64 AST_ERROR_CODE_LIST_OF_PARAMETERS_NODE_CREATION_FAILED,
65 AST_ERROR_CODE_FUNCTION_NODE_CREATION_FAILED,
66 AST_ERROR_CODE_FUNCTION_DEFINITION_NODE_CREATION_FAILED,
67 AST_ERROR_CODE_ARGUMENTS_NODE_CREATION_FAILED,
68 AST_ERROR_CODE_ARGUMENTS_APPEND_FAILED,
69 AST_ERROR_CODE_LIST_OF_ARGUMENTS_NODE_CREATION_FAILED,
70 AST_ERROR_CODE_FUNCTION_CALL_NODE_CREATION_FAILED,
71 AST_ERROR_CODE_QUOTE_NODE_CREATION_FAILED,
72 AST_ERROR_CODE_EVAL_NODE_CREATION_FAILED,
73 AST_ERROR_CODE_NEGATION_NODE_CREATION_FAILED,
74 AST_ERROR_CODE_ADDITION_NODE_CREATION_FAILED,
75 AST_ERROR_CODE_SUBTRACTION_NODE_CREATION_FAILED,
76 AST_ERROR_CODE_MULTIPLICATION_NODE_CREATION_FAILED,
77 AST_ERROR_CODE_DIVISION_NODE_CREATION_FAILED,
78 AST_ERROR_CODE_SYMBOL_NODE_CREATION_FAILED,
79 AST_ERROR_CODE_SET_NODE_CREATION_FAILED,
80 AST_ERROR_CODE_CONDITIONAL_BLOCK_NODE_CREATION_FAILED,
81 AST_ERROR_CODE_WHILE_BLOCK_NODE_CREATION_FAILED,
83 AST_UNRETRIEVABLE_ERROR_CODE,
92 struct ast **children;
105#define MAXIMUM_ERROR_MESSAGE_LENGTH 255
122ast *ast_error_sentinel(
void);
129void ast_destroy_typed_data_int(
typed_data *typed_data_int);
131typed_data *ast_create_typed_data_string(
const char *s);
136void ast_destroy_typed_data_string(
typed_data *typed_data_string);
138typed_data *ast_create_typed_data_symbol_name(
const char *s);
143void ast_destroy_typed_data_symbol_name(
typed_data *typed_data_symbol_name);
153void ast_destroy_typed_data_symbol(
typed_data *typed_data_symbol);
162void ast_destroy_typed_data_wrapper(
ast *ast_data_wrapper);
164ast *ast_create_int_node(
int i);
168ast *ast_create_string_node(
const char *str);
171ast *ast_create_symbol_name_node(
const char *str);
177ast *ast_create_error_node(ast_error_type code,
const char *message);
178void ast_destroy_error_node(
ast *ast_error_node);
179ast *ast_create_error_node_or_sentinel(ast_error_type code,
const char *message);
185ast_children_t *ast_create_ast_children_var(
size_t children_nb,...);
191bool ast_children_reserve(
ast_children_t *ast_children,
size_t capacity);
194bool ast_children_append_take(
ast *parent,
ast *child);
200ast *ast_create_children_node_arr(ast_type type,
size_t children_nb,
ast **children);
203ast *ast_create_children_node_var(ast_type type,
size_t children_nb,...);
205void ast_destroy_children_node(
ast *children_node);
208void ast_destroy(
ast *root);
210bool ast_type_has_children(ast_type type);
211bool ast_can_have_children(
ast *a);
212bool ast_has_any_child(
ast *a);
213bool ast_is_data_of(
const ast *a, data_type dt);
215char *ast_serialize(
ast *root);
216ast *ast_deserialize(
char *);
219const char *ast_type_to_string(ast_type t);
220void ast_print(
const ast *root);
221void ast_print_limited(
const ast *root,
int max_depth);
Definition interpreter.c:408