[mercury-users] More: lex and moose together
Ondrej Bojar
oboj7042 at ss1000.ms.mff.cuni.cz
Sat Jan 11 03:57:32 AEDT 2003
On Fri, 10 Jan 2003, Ondrej Bojar wrote:
> I've searched the archives and found only some discussion on this in
> summer 2001, and a diff to patch moose by Holger Krug
> (http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-developers/mercury-developers.0109/0005.html).
>
> The diff is too old for the extras-rotd-2002-12-01/moose, so I'll have to
> revert to an older moose.
I obtained moose of 2001-08-01 (cvs upd -D 2001-08-01 ...) and applied the
patch. Moose (patched for -u, unique mode for parser state) got compiled
correctly, but none of the samples work:
../moose alpha.moo
alpha.moo:49: In production for factor/1,
alpha.moo:49: the nonterminal [|]/2 is undeclared.
alpha.moo:48: In production for factor/1,
alpha.moo:48: the nonterminal [|]/2 is undeclared.
alpha.moo:41: In production for exprn/1,
alpha.moo:41: the nonterminal [|]/2 is undeclared.
alpha.moo:40: Rule exprn/1 does not have any finite derivations.
alpha.moo:23: Rule exprns/1 does not have any finite derivations.
alpha.moo:47: Rule factor/1 does not have any finite derivations.
alpha.moo:44: Rule term/1 does not have any finite derivations.
...
I'm sorry I don't understand the errors at all, as all the terminals are
correctly defined in type token:
:- type token
---> ('+')
; num(int)
; ('(')
; (')')
.
:- parse(exprns/1, token, lexer_token, xx).
...
41: exprn(Num) ---> exprn(A), ['+'], term(B), { Num = A + B }.
...
48: factor(Num) ---> ['('], exprn(Num), [')'].
49: factor(Num) ---> [num(Num)].
...
Thanks for any kind of hint, Andrew.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list