-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomaton.h
More file actions
34 lines (27 loc) · 796 Bytes
/
Copy pathautomaton.h
File metadata and controls
34 lines (27 loc) · 796 Bytes
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
32
33
34
#ifndef AUTOMATON
#define AUTOMATON
#include <stdbool.h>
typedef struct Alphabet {
unsigned int size;
char *symbols;
} Alphabet;
struct State{
char *label;
bool final;
unsigned int last_transition_index;
unsigned int total_transitions;
struct Transition **transitions;
};
typedef struct Transition{
char symbol;
struct State *next;
} Transition;
typedef struct State State;
typedef struct State Automaton;
State *init_state(char *label, bool final, unsigned int total_transitions);
State *find_state(State **states, char *label, unsigned int total_states);
Transition *create_transtion(char symbol, State *next);
void add_transition(char symbol, State *next, State **parent);
bool test(Automaton *automaton, Alphabet *alphabet, char *sequence);
char *get_label();
#endif