Version française
Home     About     Download     Resources     Contact us    
Browse thread
Define parser and printer consistently
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yitzhak Mandelbaum <yitzhakm@C...>
Subject: Re: [Caml-list] Define parser and printer consistently
PADS/ML can do that for you, and more. You can find information about the PADS languages and tools here: 

http://www.padsproj.org

including papers and a manual. The website doesn't have the most recent release of PADS/ML -- i plan to put it up on Github shortly -- but if you're interested, i'm happy to send you a tarball.

The basic idea is that you specify your grammar as a type-like declaration.  Then, pads/ml generates an AST, parser, printer and some more stuff for you.  The generated parser is like a PEG parser, but with support context-sensitive parsing. That is, it is deterministic, with ordered choice; and, it is scannerless. So, the grammars-writing style has some significant differences from ocamllex and ocamlyacc.

PADS/ML has an Eclipse license.

Cheers,
Yitzhak


On Dec 8, 2010, at 11:47 PM, Dawid Toton wrote:

> I'm going to define a parser and a printer for a simple grammar.
> Is there a way to define both of them in a single construct using some existing OCaml tool?
> 
> For example, I have a keyword "function". The usual parser would contain a mapping like:
> "function" -> `Function
> and the straightforward printer would do:
> `Function -> "function"
> 
> What is the best way to combine these definitions, so that duplication would be minimized?
> To be precise, avoiding duplication is not exactly what I need. I'm looking for something that would prevent making inconsistent changes to the parser and the printer.
> 
> Dawid
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

-----------------------------
Yitzhak Mandelbaum