pseudocode added
authorMart Lubbers <mart@martlubbers.net>
Fri, 13 Feb 2015 12:13:08 +0000 (13:13 +0100)
committerMart Lubbers <mart@martlubbers.net>
Fri, 13 Feb 2015 12:13:08 +0000 (13:13 +0100)
thesis2/5.appendices.tex

index 952575e..a3461f0 100644 (file)
@@ -7,8 +7,28 @@ register:=$\emptyset$
 while there is another word
        word = next word
        commonprefix = CommonPrefix(word)
-       laststate = $\delta^*(q_0, $commonprefix)
-       currentsuffix
+       laststate = delta_star(q0, commonprefix)
+       currentsuffix = word[length(commonprefix)..length(word)]
+       if has_children(laststate)
+       then
+               replace_or_register(last_state)
+       endif
+       add_suffix(laststate, currentsuffix)
+endwhile
+replace_or_register(q0)
+
+function replace_or_register(state)
+       child = last_child(state)
+       if has_children(child)
+               replace_or_register(child)
+       fi
+       if there is an equivalent state q
+               last_child(state = q
+               delete(child)
+       else
+               register.add(child)
+       endif
+endfunction
        \end{minted}
 \end{listing}