Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A good ocaml parser? [closed]

I'm looking for a good ocaml parsing library that isn't a derivative of flex/bison. Ideally, I'd like a monadic combinator library along the lines of parsec, but I can't find anything.

I would use haskell, but making llvm bindings for haskell is proving more tiresome than I originally thought.

Cheers,

Duane

like image 442
duane Avatar asked Nov 21 '08 01:11

duane


People also ask

What is menhir OCaml?

What is Menhir? Menhir is a LR(1) parser generator for the OCaml programming language. That is, Menhir compiles LR(1) grammar specifications down to OCaml code. Menhir was designed and implemented by François Pottier and Yann Régis-Gianas. Menhir is 90% compatible with ocamlyacc.

How do parser generators work?

A parser generator takes a grammar as input and automatically generates source code that can parse streams of characters using the grammar. The generated code is a parser, which takes a sequence of characters and tries to match the sequence against the grammar.


1 Answers

Here's one library, via Google. (Which also brought up this and this, which lists several more relevant-sounding libraries.)

When I wrote a combinator parser in ML, it turned out rather cumbersome to use because of the value restriction and eager evaluation, which forced you to eta-expand your grammar rules. Ocaml is said to be more relaxed about the value restriction, though -- maybe you'll be spared some of that pain.

like image 182
Darius Bacon Avatar answered Oct 14 '22 12:10

Darius Bacon