Newbie Question: Reading older grammar rule code...
- From: "Charles Turner" <vze26m98@xxxxxxxxxxxxx>
- Date: 17 Sep 2006 07:19:41 -0700
Hi all-
Hope this isn't too much of an RTFM question: I'm pretty new to Prolog
and Grammar Rules, trying to get a piece of code from the mid-80s to
run with GNU-Prolog. The excerpts below come from Louis Odette's
"Compiling Prolog to Forth" published in JFAR, 4/4.
Also, the xerox I have of his paper is not the best, so my ability to
distinguish square "[" from curly "{" braces is quite compromised.
GNU-Prolog gives a compliation error, for example, here at the
asterisked line:
args(Vars, Old, New, Num0, Num1) -->
simple_term(Vars, Old, N1),
* ([','], [Num is Num0+1], args(Vars, N1, New, Num, Num1) |
[New = N1, Num1 is Num0+1]).
which seems fair, considering GNU-Prolog doesn't support "|" as the
disjunction operator. But later on in the code, Odette wrote this:
variable(Vars, Old, ['VAR', Num |Old]) -->
[Var], [char(1, Var, L), ascii(L, M),
(ascii('_', M) ;
ascii('A', _a), ascii('Z', _z), _a =< M, M =< _z),
memberchkN(Var, Vars, 0, Num)], !.
where a ";" is used explicitly: the only instance.
I suppose this could be some sort of typo, but I'm hoping someone might
clarify the use of these operators. Perhaps "|" meant something other
than disjunction for some Prolog(s) in the mid-80s?
Many thanks! Charles Turner
.
- Follow-Ups:
- Re: Newbie Question: Reading older grammar rule code...
- From: Jan Wielemaker
- Re: Newbie Question: Reading older grammar rule code...
- Prev by Date: Re: The n-knights problem
- Next by Date: SWI-Prolog : Out Of Local Stack
- Previous by thread: SWI-Prolog : Constructing Exceptions
- Next by thread: Re: Newbie Question: Reading older grammar rule code...
- Index(es):
Relevant Pages
|
|