progress using dfa for searching

This commit is contained in:
2025-10-06 09:55:05 +01:00
parent 626aa0a860
commit 3f30d49420
4 changed files with 196 additions and 254 deletions

View File

@@ -501,7 +501,7 @@ struct
end
fun fromString str =
case ParseDfa.parse (str, 0) of
case ParseDfa.parse (str ^ "\^@", 0) of
SOME (ast, _) => ToDfa.convert ast
| NONE => Vector.fromList []
@@ -513,7 +513,11 @@ struct
end
fun isFinal (dfa: dfa, curState) =
curState <> ~1
andalso
let val curTable = Vector.sub (dfa, curState)
in Vector.sub (curTable, 0) <> ~1
end
fun isDead curState = curState = ~1
end