[m-dev.] cc_multi or det ?

Ralph Becket rbeck at microsoft.com
Tue Aug 7 02:01:05 AEST 2001


> From: Holger Krug [mailto:hkrug at rationalizer.com]
> Sent: 06 August 2001 16:44
> 
> On Mon, Aug 06, 2001 at 08:31:29AM -0700, Ralph Becket wrote:
> > Thinking more about this, since the motivation for this is to allow
> > the lexer component of a parsing appliction to report input errors,
> > perhaps the best thing to do would be to assume the parser can
> > recognise such things as int_too_large tokens and deal with them at
> > that level (as opposed to checking for strings returned in error
> > terms) rather than much about with catching exceptions etc. in
> > lex itself.
> >
> > Now I think about this, that seems a preferable way to go.
> 
> I deem, the compoment which does the conversion from string to int
should
> do the checks, too.

Sure, the idea was that rather than raise an exception to be turned
into an error to be handled by the parser, you'd simply return a
*different* token which would be interpreted by the parser as an
error!

For example,

( +(digit)    ->     num_str_to_token )

where

num_str_to_token(Str) =
    ( if too_many_digits(Str) then num_overflow_token(Str)
                              else num(string__det_to_int(Str))
    ).

> 
> Can we agree on your proposal to call them `lex__read_cc_multi is
cc_multi'
> and `lex__read is det' ?

Sure, it's time to put this one to bed.

- 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