[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: comments searched on bit of ocaml code ...



On Thu, Dec 29, 2005 at 03:32:13PM +0100, Sven Luther wrote:
> Anyway, it has been a long time since i wrote serious ocaml code, and i have
> some doubts about the best way to parse strings, preferably using the less
> non-ocaml stuff, so i post my snipplet here for comments.

Looking at what you need to do the best way to parse string I can
suggest you is the combo:

  Stream.of_string + camlp4's stream parsers

It is all in the standard ocaml distribution, no need of non-ocaml code,
no need of extra libraries. Using that kind of streams you basically get
recursive descendent parsers with backtracking inside the same "parser"
structure (IIRC).

They are well documented in the ocaml manual. For samples you can look
at some Gerd's code which uses them to parse configuration files (e.g.
the findlib one).

Cheers.
... Zack in hurry due to house moving ...

-- 
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-

Attachment: signature.asc
Description: Digital signature


Reply to: