[m-rev.] global store implemented using typeclass

Holger Krug hkrug at rationalizer.com
Thu Jul 26 02:06:17 AEST 2001


On Thu, Jul 26, 2001 at 12:50:42AM +1000, Fergus Henderson wrote:
> I don't have any great ideas about that... `mutvar'?

OK. I first have to finish some other work but will deliver at the
latest at the beginning of the next weak. Enhanced versions of moose
(allowing unique parser_states, already implemented but still has to
be tested) and maybe lex will follow later.

Concerning lex I'm planning to replace the main types in about the
following way:

Old version:

:- type lexeme(Token)
    --->    lexeme(
                lxm_token               :: Token,
                lxm_regexp              :: regexp
            ).

:- type annotated_token(Token)
    --->    noval(Token)                % Just return ok(Token) on success.
    ;       value(Token)                % Return ok(Token, String) on success.
    ;       ignore.                     % Just skip over these tokens.


New version:

:- type lexeme(Token)
    --->    lexeme(
                lxm_token         :: func(string::in)=(Token::out) is det,
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                lxm_regexp        :: regexp
            ).

:- type annotated_token(Token)
    --->    t(Token)                    % Return t(Token) on success.
    ;       ignore.                     % Just skip over these tokens.

Together with corresponding changes in the predicate definitions
one would get a cleaner interface to the token consumer, because
no further postprocessing of string values would be needed.

Is this OK ?

-- 
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
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