/* Prolog Tutorial 7.1 */

s1 --> [a], s1.
s1 --> b.

b --> [b,b].

/*----------------------------*/

s_1 --> a, b.

a --> [].    % empty production
a --> [a],a.

/*----------------------------*/

s2 --> a(N), b(N), c(N).

a(0) --> [].
a(M) --> [a],
         a(N),
         {M is N + 1}.  % embedded Prolog Goal

b(0) --> [].
b(M) --> [b],
         b(N),
         {M is N + 1}.

c(0) --> [].
c(M) --> [c],
         c(N),
         {M is N + 1}.

