[m-dev.] cc_multi or det ?

Ralph Becket rbeck at microsoft.com
Tue Aug 7 01:21:47 AEST 2001


> From: Fergus Henderson [mailto:fjh at cs.mu.OZ.AU]
> Sent: 06 August 2001 16:11
> 
> For such a situation, I'd recommend declaring the entry point
`cc_multi'.
> The user can always add `promise_only_solution' themselves if need be.
> 
> Alternatively, you could provide two different entry points,
> a cc_multi one named `lex__main' (or whatever you want to call your
entry point),
> and a det one named `lex__promise_only_solution_main' that just
> wraps promise_only_solution around `lex__main'.

The interface is that the user supplies a list of 
(regexp - token_constructor) pairs, where each token_constructor is
a *function* from strings to tokens.  The lexer internals catch any
lex__excn(string) exceptions raised by a token_constructor in order
to construct an error result (e.g. a token_constructor for ints may
want to report overflow errors this way).

Since the determinism of a token_constructor has to be det, it seems
reasonable that the determinism of the lexer itself will also be det
and that the use of promise_only_solution internally is legitimate.

My feeling is that other exceptions could be raise all over the shop, 
but that doesn't warrant changing all dets into cc_multis.

- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list