Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool accept(automaton *am, int dep, char *word, state_t act_st) {
- if (dep == strlen(word)) {
- return am->acc[act_st]; // true if accepting
- }
- bool res;
- int idx = alph_idx(word[dep]);
- if (is_existential(am, act_st)) {
- res = false;
- int i = 0;
- while (!res && am->T[act_st][idx][i] != (char) -1) {
- if (accept(am, dep + 1, word, (state_t) am->T[act_st][idx][i]))
- res = true;
- i++;
- }
- }
- else { // universal
- res = true;
- int i = 0;
- while (res && am->T[act_st][idx][i] != (char) -1) {
- if (accept(am, dep + 1, word, (state_t) am->T[act_st][idx][i]))
- res = false;
- i++;
- }
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement