aboutsummaryrefslogtreecommitdiffstats
path: root/src/frontend/parser.h
diff options
context:
space:
mode:
authorGalin Simeonov <gts@volconst.com>2021-06-01 18:21:02 +0300
committerGalin Simeonov <gts@volconst.com>2021-07-15 18:03:43 +0300
commit85b23fbee717f047af5a89eac6f4dba8e7812524 (patch)
treedc88ef3f4cb826f4f3a3c9e12c67562878460aa5 /src/frontend/parser.h
parent255a49ba5a41b3854dbdfebdec75fb6229450507 (diff)
downloadMEGATRON-85b23fbee717f047af5a89eac6f4dba8e7812524.tar.gz
restructuring
Diffstat (limited to 'src/frontend/parser.h')
-rw-r--r--src/frontend/parser.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/frontend/parser.h b/src/frontend/parser.h
index ef82184..eaede84 100644
--- a/src/frontend/parser.h
+++ b/src/frontend/parser.h
@@ -7,6 +7,7 @@
enum AST_Type
{
+ AST_TYPE_TRANSLATION_UNIT,
AST_TYPE_MACHINE,
AST_TYPE_STATE,
AST_TYPE_STATES,
@@ -23,13 +24,12 @@ struct AST
};
struct AST_State
{
- enum AST_Type type;
- struct token *id;
+ struct token *name;
+ size_t number;
};
struct AST_Event
{
- enum AST_Type type;
- struct token *id;
+ struct token *name;
};
struct AST_States
{
@@ -65,6 +65,12 @@ struct AST_Pipeline
size_t size;
struct AST_Command *pipeline[];
};
+struct AST_Transitions
+{
+ enum AST_Type type;
+ size_t size;
+ struct AST_Transition *transitions[];
+};
struct AST_Machine
{
enum AST_Type type;
@@ -73,15 +79,17 @@ struct AST_Machine
struct AST_Events *events;
struct AST_Transitions *transitions;
};
-struct AST_Transitions
+struct AST_Translation_Unit
{
enum AST_Type type;
- size_t size;
- struct AST_Transition *transitions[];
+ struct Map *used_commands_map;
+ size_t number_of_machines;
+ struct AST_Machine *machines[];
};
-struct AST* parse_unit(struct Translation_Data *translation_data);
+struct AST* parse_source(struct Translation_Data *translation_data);
+struct AST_Translation_Unit* parse_translation_unit(struct Translation_Data *translation_data);
struct AST_Machine* parse_machine(struct Translation_Data *translation_data);
struct AST_Machine* parse_machine_inner(struct token *machine_id,struct Translation_Data *translation_data);
struct AST_States* parse_states_inner(struct Translation_Data *translation_data);
@@ -104,6 +112,7 @@ struct AST_Command* get_ast_command(struct token *function_name,struct token *ar
struct AST_Pipeline* get_ast_pipeline(struct Queue *pipeline);
struct AST_Machine* get_ast_machine(struct token *id,struct AST_States *states,struct AST_Events *events,struct AST_Transitions *transitions,struct AST_State *starting_state);
struct AST_Transitions* get_ast_transitions(struct Queue *transitions);
+struct AST_Translation_Unit* get_ast_translation_unit(struct Queue *machines,struct Map *command_map);
void delete_ast(struct AST* ast);
@@ -116,6 +125,7 @@ void delete_ast_command(struct AST_Command* ast);
void delete_ast_pipeline(struct AST_Pipeline* ast);
void delete_ast_machine(struct AST_Machine* ast);
void delete_ast_transitions(struct AST_Transitions* ast);
+void delete_ast_translation_unit(struct AST_Translation_Unit *ast);
void pointer_array_fill(void **array,struct Queue *q);