What's the standard way of implementing an automaton with not-transitions?

53 views Asked by At

The naive implementation of a FA would have the node look like:

struct Node {
    string label;
    Node*[char] trans;
}

But what if one of your transitions is "![a]" (anything but the char 'a'). And your alphabet is too huge to store all possible chars that are not 'a'. Do you see what I mean?

Edit. My current guess is

struct NFAState {
    string label;
    Node*[][char] trans;
    Node*[][char] notTrans;
    Node*[] epsTrans;
}

for an NFA node.

1

There are 1 answers

1
RaphMclee On BEST ANSWER

You could add a second Node*[char] notTrans; and store all nodes for the not cases.