[m-rev.] fix determinism warnings in moose generated parsers

Julien Fischer juliensf at students.cs.mu.OZ.AU
Thu Jul 24 19:48:20 AEST 2003


Estimated hours taken: 0.1.
Branches: main.

(This a solution to this problem but it may not be the best one so if
there are any other suggestions ...)

extras/moose/moose.m:
	Avoid spurious determinism warnings in the generated goto<State>
	predicates.  These is by the fact that a goto<State> pred. is
	declared as semidet even if it matches against all nonterminals
	(in which case it is actually det).

extras/moose/samples/Mmakefile:
	Use `--halt-at-warn' when compiling moose generated parsers.


Index: moose.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/moose/moose.m,v
retrieving revision 1.7
diff -u -r1.7 moose.m
--- moose.m	16 Jul 2003 07:16:02 -0000	1.7
+++ moose.m	24 Jul 2003 09:20:49 -0000
@@ -596,7 +596,10 @@
 		Term = functor(atom(Name),
 			[Token, functor(integer(NS), [], Ctxt)], Ctxt),
 		varset__init(Varset),
-		term_io__write_term_nl(Varset, Term, !IO)
+		term_io__write_term(Varset, Term, !IO),
+			% This is needed to prevent spurious determinism
+			% warnings when compiling the generated parser.
+		io__write_string(" :- semidet_succeed.\n", !IO)
 	), StateActions, !IO),
 	io__nl(!IO).

Index: samples/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/moose/samples/Mmakefile,v
retrieving revision 1.1
diff -u -r1.1 Mmakefile
--- samples/Mmakefile	22 May 2000 05:22:16 -0000	1.1
+++ samples/Mmakefile	24 Jul 2003 09:23:10 -0000
@@ -1,4 +1,6 @@

+MCFLAGS=--halt-at-warn
+
 .SUFFIXES: .m .moo

 default_target : all
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list