On Thu, 25 Jan 2007, Martin DeMello wrote:
> I'm starting on a project for which I'll need to parse a javascript
> file, and I was wondering what people would suggest for the parser
> part. Are lex and yacc my best option, or should I be looking at
> something like parser combinators? Mainly, I'm concerned that by
> sticking to lex and yacc I'm merely using stuff imported from the C
> world, and missing out on more powerful options that a functional
> language might offer me.
>
> There's no real time frame on this - it's partly itch scratching and
> partly a learning exercise - so I'm willing to pick up something that
> might take me longer to master, but will be a better addition to my
> toolbox in the long run.
If you're interested, I can send you 3 different JSON parsers:
* ocamllex + ocamlyacc (we chose this one for json-wheel)
* ocamllex + camlp4 EXTEND (was a bit complicated after all and a bit slower)
* ocamllex + just streams (was a bit more verbose than the ocamlyacc version)
I don't know how parser combinators behave, and I haven't tried menhir
instead of ocamlyacc.
Martin
--
Martin Jambon
http://martin.jambon.free.fr
.