Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:ndfa_interpreter [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Ndfa interpreter ======
 +{{tag>​NDFA automata interpreter}}
 +===== Description =====
 +An interpreter for a nondeterministic finite automaton (NDFA)
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{ndfa_interpreter.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 + accept(Xs) :-
 + The string represented by the list Xs is accepted by
 + the NDFA defined by initial/1, delta/3, and final/1.
 +*/
 + accept(Xs) :- initial(Q), accept(Xs,​Q).
 +
 + accept([X|Xs],​Q) :- delta(Q,​X,​Q1),​ accept(Xs,​Q1).
 + accept([],​Q) :- final(Q).
 +
 +
 + initial(q0).
 + final(q0).
 +
 + delta(q0,​a,​q1).
 + delta(q1,​b,​q0).
 +
 +%   ​Program 17.1: An interpreter for a nondeterministic finite automaton (NDFA)
 +% Program 17.2: An NDFA that accepts the language (ab)*
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/ndfa_interpreter.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0