Re: Looking for a nail

From: Hendrik Tews (
Date: Thu Jan 28 1999 - 21:10:13 MET

Date: Thu, 28 Jan 1999 21:10:13 +0100
Message-Id: <>
From: Hendrik Tews <>
Subject: Re: Looking for a nail
In-Reply-To: <>


   From: Ian T Zimmerman <>
   Date: Tue, 26 Jan 1999 11:20:47 -0800
   Subject: Re: Looking for a nail
    [concerning an oo interface to ocamllex]
   No. Sorry, but I don't want to be forced to use classes. I want to

Hold on! This was only a suggestion to somebody looking for a
nail! I agree that the possibility of choosing between (or even
mixing) the functional and the oo paradigm is one of the great
advantages of ocaml. Therefore there should always be a
functional version of the standard libray. But, by the same
argument it would be nice, to have an oo version.

> - adding start conditions a la flex to ocamllex
   I haven't thought of this really hard, but I bet there is already a
   way to do that. If there isn't, I would think hard again to find a
   cleaner, more functional (less stateful) way to do it. If the current
   condition is kept in a global as in flex, that just drops again the
   reentrancy that Christian has been working so hard to achieve.

Yes, indeed, you can do the following:

           type lexer_state_type = A | B
           let lexer_state = ref A

        rule token = parse
           "" { match !lexer_state with
                                            A -> atoken lexbuf
                                          | B -> btoken lexbuf

        and atoken = parse ...

But it would be nice to have an intuitive syntax for that.



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET