Fix error converting NFA to DFA

I didn't handle epsilon transitions correctly, now I hopefully do.
This commit is contained in:
Joscha 2019-10-26 19:47:22 +00:00
parent 0082c427ed
commit 152335e267
2 changed files with 2 additions and 1 deletions

View file

@ -64,7 +64,7 @@ allNextStates s =
ndStateToDfaState :: (Ord s, Ord t) => Nfa.Nfa s t -> Nfa.NdState s -> Dfa.State (Nfa.NdState s) t
ndStateToDfaState nfa ns =
let specialTokens = allSpecialTokens $ Nfa.getNdState nfa ns
let specialTokens = allSpecialTokens . Nfa.getNdState nfa $ Nfa.epsilonStep nfa ns
in Dfa.State { Dfa.transitions = Map.fromSet (\t -> Nfa.transition nfa t ns) specialTokens
, Dfa.defaultTransition = Nfa.defaultTransition nfa ns
, Dfa.accepting = Nfa.accepting nfa ns

View file

@ -21,6 +21,7 @@ module Rextra.Nfa (
, NdState
, getNdState
-- *** Transitions
, epsilonStep
, transition
, defaultTransition
-- *** Running the whole automaton