List Info

Thread: Re: "ocaml_beginners"::[] Context-dependent lexing




Re: "ocaml_beginners"::[] Context-dependent lexing
country flaguser name
United Kingdom
2007-08-24 13:49:03

On Friday 24 August 2007 18:47:07 cultural_sublimation wrote:
> Hi again,
>
> > I have now switched to ulex, but I've encountered another problem:
> > how does one bind a regular expression to a variable? In ocamllex
> > the "as" operator made it fairly straightforward:
>
> I have searched through the source code of CDuce (which uses ulex)
> and couldn't find anything even vaguely resembling the "as" operator
> from ocamllex. I am assuming no such operator exists in ulex. The
> only way to extract substrings seems to be via the low-level
> sub_lexeme functions.

Ah, that really sucks. I love named subpatterns with "as" in ocamllex. That's
one of the things I miss in F#...

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e

__._,_.___
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Endurance Zone

A Yahoo! Group

Learn how to

increase endurance.

Yoga Resources

on Yahoo! Groups

Take the stress

out of your life.

Re: "ocaml_beginners"::[] Context-dependent lexing
country flaguser name
United States
2007-08-24 15:57:37

> Ah, that really sucks. I love named subpatterns with "as" in ocamllex.
> That's one of the things I miss in F#...

Indeed. Ulex seems like a really cool idea, but it
still has a few warts. I would only recommend it if you
*really* need to lex Unicode and are willing to deal with
its shortcomings (such as the lack of the "as" operator
and bad documentation). Ocaml beginner's will spare
themselves a lot of grief if they just stick with ocamllex:
the documentation is a lot better and it integrates more
easily with ocamlyacc.

On a related note, does anyone know how to convince
ocamlyacc that the tokenizer function (called, for example,
"token", and returning a value of token_t) should have a
signature like (Ulexing.lexbuf -> token_t) ?

Ocamlyacc seems hard-wired to assume that the tokenizer has
a (Lexing.lexbuf -> token_t) signature, which is obviously
wrong if you're using ulex. (Just one of those warts that
has been causing me some grief...)

Thanks for your attention,
C.S.

__._,_.___
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Ads on Yahoo!

Learn more now.

Reach customers

searching for you.

Yahoo! Groups

Join a yoga group

and take the stress

out of your life.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )