[m-rev.] State variable syntax transformation

Simon Taylor stayl at cs.mu.OZ.AU
Tue Feb 12 17:08:40 AEDT 2002


On 07-Feb-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> I have a test harness and list of test cases (appended after the diffs)
> which I would like to save somewhere for regression testing.  However,
> since the test harness directly imports the transformation module which
> lives in the compiler directory, it cannot exist as a stand-alone test
> program.  Any suggestions?

It would be better to write the test case as a valid Mercury program.
Maybe you could compare the output of `mmc --convert-to-mercury'.

> Index: prog_io_state_vars.m
> ===================================================================
> +% * We should add checks too ensure that no state variable has the same name
> +%   as a normal var.

I'd prefer that you do this before you commit.

> +% * It would be nice if the names given to variables reflected the state
> +%   var they belong to, rather than just using the default _1, _2, _3, ...

This shouldn't be too difficult, should it? Error messages referring to
`_1' would be pretty awful, so this should be fixed before you commit.
I'd suggest using names like '!.IO_1'.

> +:- pred xform_compound(subs, term, term, varset, varset).
> +:- mode xform_compound(in, in, out, in, out) is semidet.
> +
> +xform_compound(S,
> +        functor(atom(","), [P0, Q0], C),
> +        functor(atom(","), [P,  Q ], C),
> +        VS0, VS
> +) :-

prog_io_state_vars should be called after the goal has been parsed by
prog_io_goal. This will avoid problems if new syntax is added.
For example, you haven't handled parallel conjunctions (&).

To be continued.

Simon.
--------------------------------------------------------------------------
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