diff options
author | Galin Simeonov <gts@volconst.com> | 2021-05-31 22:02:10 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:00:15 +0300 |
commit | 255a49ba5a41b3854dbdfebdec75fb6229450507 (patch) | |
tree | 616ea5786cb91d03ef609d32b402941dc30e926b /parser.h | |
parent | f768d9bdb84e846d89aac66a4f3433a44241c298 (diff) | |
download | MEGATRON-255a49ba5a41b3854dbdfebdec75fb6229450507.tar.gz |
added cmake file
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/parser.h b/parser.h deleted file mode 100644 index ef82184..0000000 --- a/parser.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef PARSER_H -#define PARSER_H PARSER_H -#include <program.h> -#include <stddef.h> -#include <assert.h> -#include <map.h> - -enum AST_Type -{ - AST_TYPE_MACHINE, - AST_TYPE_STATE, - AST_TYPE_STATES, - AST_TYPE_EVENT, - AST_TYPE_EVENTS, - AST_TYPE_TRANSITION, - AST_TYPE_TRANSITIONS, - AST_TYPE_COMMAND, - AST_TYPE_PIPELINE, -}; -struct AST -{ - enum AST_Type type; -}; -struct AST_State -{ - enum AST_Type type; - struct token *id; -}; -struct AST_Event -{ - enum AST_Type type; - struct token *id; -}; -struct AST_States -{ - enum AST_Type type; - size_t number_of_states; - struct Map *states_map; - struct AST_State *states[]; -}; -struct AST_Events -{ - enum AST_Type type; - size_t number_of_events; - struct Map *events_map; - struct AST_Event *events[]; -}; -struct AST_Transition -{ - enum AST_Type type; - struct AST_State *from; - struct AST_State *to; - struct AST_Event *event; - struct AST_Pipeline *pipeline; -}; -struct AST_Command -{ - enum AST_Type type; - struct token *function_name; - struct token *argument; -}; -struct AST_Pipeline -{ - enum AST_Type type; - size_t size; - struct AST_Command *pipeline[]; -}; -struct AST_Machine -{ - enum AST_Type type; - struct token *id; - struct AST_States *states; - struct AST_Events *events; - struct AST_Transitions *transitions; -}; -struct AST_Transitions -{ - enum AST_Type type; - size_t size; - struct AST_Transition *transitions[]; -}; - - -struct AST* parse_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); -struct AST_State* parse_state(struct Translation_Data *translation_data); -struct AST_Events* parse_events_inner(struct Translation_Data *translation_data); -struct AST_Event* parse_event(struct Translation_Data *translation_data); -struct AST_Transitions* parse_transitions_inner(struct Translation_Data *translation_data,struct AST_States *states,struct AST_Events *events ); -struct AST_Transition* parse_transition(struct Translation_Data *translation_data,struct AST_States *states,struct AST_Events *events); -struct AST_Pipeline* parse_pipeline(struct Translation_Data *translation_data); -struct AST_Command* parse_command(struct Translation_Data *translation_data); -struct AST_State* parse_start_on(struct Translation_Data *translation_data,struct AST_States *states); - - -struct AST_State* get_ast_state(struct token *id); -struct AST_Event* get_ast_event(struct token *id); -struct AST_States* get_ast_states(struct Queue *states); -struct AST_Events* get_ast_events(struct Queue *events); -struct AST_Transition* get_ast_transition(struct AST_State *from,struct AST_State *to,struct AST_Event *event,struct AST_Pipeline *pipeline); -struct AST_Command* get_ast_command(struct token *function_name,struct token *argument); -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); - - -void delete_ast(struct AST* ast); -void delete_ast_event(struct AST_Event* ast); -void delete_ast_states(struct AST_States* ast); -void delete_ast_state(struct AST_State* ast); -void delete_ast_events(struct AST_Events* ast); -void delete_ast_transition(struct AST_Transition* ast); -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 pointer_array_fill(void **array,struct Queue *q); -struct Queue* parse_list(struct AST *(*parser)(struct Translation_Data*),struct Translation_Data *translation_data,enum Keyword delim); - -#endif |