Skip to content

Instantly share code, notes, and snippets.

@lukhnos
Created November 1, 2012 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukhnos/3991994 to your computer and use it in GitHub Desktop.
Save lukhnos/3991994 to your computer and use it in GitHub Desktop.
DFA for parsing McBopomofo data.txt (Graphviz)
# Parser DFA for McBopomofo's data.txt
#
# Regular expression equivalent:
#
# (\n*\w\w*\s\w\w*\s\w\w*)*$
#
digraph finite_state_machine {
rankdir = LR;
size = "10";
node [shape = doublecircle]; End;
node [shape = circle];
Start -> End [ label = "EOF"];
Start -> Error [ label = "\\s" ];
Start -> Start [ label = "\\n" ];
Start -> 1 [ label = "\\w" ];
1 -> Error [ label = "\\n, EOF" ];
1 -> 2 [ label = "\\s" ];
1 -> 1 [ label = "\\w" ];
2 -> Error [ label = "\\n, \\s, EOF" ];
2 -> 3 [ label = "\\w" ];
3 -> Error [ label = "\\n, EOF "];
3 -> 4 [ label = "\\s" ];
3 -> 3 [ label = "\\w" ];
4 -> Error [ label = "\\n, \\s, EOF" ];
4 -> 5 [ label = "\\w" ];
5 -> Error [ label = "\\s, EOF" ];
5 -> Start [ label = "\\n" ];
5 -> 5 [ label = "\\w" ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment