Abc language recognition

Description

Recognizing the language a^Nb^Nc^N

Source: The Art of Prolog

Download

Program source code: abc_language_recognition.pl

Listing

        s(N) --> a(N), b(N), c(N).
 
        a(N) --> [a], a(N1), {N is N1+1}.
        a(0) --> [ ].
 
        b(N) --> [b], b(N1), {N is N1+1}.
        b(0) --> [ ].
 
        c(N) --> [c], c(N1), {N is N1+1}.
        c(0) --> [ ].
 
%      Program 19.2:  Recognizing the language a^Nb^Nc^N

Comments

pl/prolog/pllib/abc_language_recognition.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