blob: 8b865fd126028e8a6bd0500f68399dbb9990e1e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#ifndef BACKEND_H
#define BACKEND_H BACKEND_H
#include <parser.h>
#include <ast_to_c.h>
#include <map.h>
/*
* describes a given state and the transitions coming out of it
* I should probbably have done this in the parsing stage
*/
struct State_And_Transitions
{
struct AST_State *state;
size_t number_of_transitions;
struct AST_Transition *transitions[];
};
/*returns an array of state_and_transition structs*/
struct State_And_Transitions** extract_transition_table(struct AST_States *states,struct AST_Transitions *transitions);
/*extracts a state from the expression that belongs in the states structure*/
struct AST_State* extract_state(struct AST *expression,struct AST_States *states);
void anotate_unchecked_states(struct AST_Translation_Unit *unit,struct Translation_Data *translation_data);
void anotate_machine(struct AST_Machine *machine,struct AST_Translation_Unit *unit,struct Translation_Data *translation_data);
struct AST* anotate_expression(struct AST *expression,struct AST_Translation_Unit *unit,struct AST_Machine *current_machine,struct Translation_Data *translation_data);
_Bool expression_is_binary(struct AST* expression);
_Bool expression_is_unary(struct AST* expression);
_Bool state_is_in_states(struct AST_State *state,struct AST_States *states);
_Bool check_expression(struct AST *state,struct AST_Translation_Unit *unit);
_Bool check_transition(struct AST *state,struct AST_Translation_Unit *unit);
#endif
|