List Info

Thread: "ocaml_beginners"::[] slightly offtopic - parsers




"ocaml_beginners"::[] slightly offtopic - parsers
user name
2007-01-24 13:04:51

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.

martin

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] slightly offtopic - parsers
user name
2007-01-24 14:54:32

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

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] slightly offtopic - parsers
user name
2007-01-25 06:03:44

On 1/25/07, Martin Jambon < martin_jambon%40emailuser.net">martin_jambonemailuser.net> wrote:
&gt;
> 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)

yes please - that sounds interesting.

martin

__._,_.___
.

__,_._,___
[1-3]

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