Skip to content

Instantly share code, notes, and snippets.

@stesh
Created January 26, 2012 21:41
Show Gist options
  • Save stesh/1685281 to your computer and use it in GitHub Desktop.
Save stesh/1685281 to your computer and use it in GitHub Desktop.
Le machine à rire.
initial(q0).
terminal(q3).
arc(q0, "h", q1).
arc(q1, "a", q2).
arc(q2, "h", q1).
arc(q2, "!", q3).
aef(S) :-
string_to_list(S, L),
initial(Q),
reconnaitre(Q, L).
reconnaitre(Q, []) :-
terminal(Q).
reconnaitre(Qcourant, [X|L]) :-
arc(Qcourant, X, Qsuivant),
reconnaitre(Qsuivant, L).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment