Johnson Wang wrote:
> If I use JFlex to merge more than one DFA into one( use '|' connect each
> other), then about the final DFA, how to know which regular
> expression does the final states comes from?
> For instance:
> Regular Expression1(r1): a|b
> Regular Expression2(r2): a|c
> We use '|' to connect these two regular expressions: a|b|a|c
> Then, about the final states, how do we know the states comes from r1 or r2?
There is no general way to know. If you want to distinguish two expressions, you
should match them separately in JFLex, otherwise the minimisation algorithm will
collapse the final states into one.
There is no speed penalty for matching them separately in JFlex (unless the two
DFAs have thousands of state).
Cheers,
Gerwin
|