Re: Parsing Context-sensitive languages with Prolog
- From: Markus Triska <triska@xxxxxxxx>
- Date: Mon, 21 Jan 2008 16:24:25 +0100
Alessandro <askmeformymail@xxxxxxxxxx> writes:
I seek a *good* exemple in Prolog, perhaps with the langage { a^n b^n
c^n } that is known to be context-sensitive
What about:
anbncn --> n_x(N, a), n_x(N, b), n_x(N, c).
n_x(0, _) --> [].
n_x(s(N), X) --> [X], n_x(N, X).
Yielding:
%?- anbncn(Ls, []).
%@ Ls = [] ;
%@ Ls = [a, b, c] ;
%@ Ls = [a, a, b, b, c, c] ;
%@ Ls = [a, a, a, b, b, b, c, c, c] a
%@ Yes
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
.
- Follow-Ups:
- Re: Parsing Context-sensitive languages with Prolog
- From: Jan Burse
- Re: Parsing Context-sensitive languages with Prolog
- From: Alessandro
- Re: Parsing Context-sensitive languages with Prolog
- References:
- Parsing Context-sensitive languages with Prolog
- From: Alessandro
- Parsing Context-sensitive languages with Prolog
- Prev by Date: Parsing Context-sensitive languages with Prolog
- Next by Date: Re: Parsing Context-sensitive languages with Prolog
- Previous by thread: Parsing Context-sensitive languages with Prolog
- Next by thread: Re: Parsing Context-sensitive languages with Prolog
- Index(es):