From: "CUOQ Pascal" <Pascal.CUOQ@cea.fr>
To: <caml-list@yquem.inria.fr>
Subject: Define parser and printer consistently
Date: Thu, 9 Dec 2010 12:11:15 +0100 [thread overview]
Message-ID: <5EFD4D7AC6265F4D9D3A849CEA92191902182AD9@LAXA.intra.cea.fr> (raw)
In-Reply-To: <20101209110003.3C0B3BBAF@yquem.inria.fr>
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
>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?
Take a look at Boomerang: http://www.seas.upenn.edu/~harmony/
>From the overview:
Boomerang is a programming language for writing lenseswell-behaved bidirectional transformationsthat operate on ad-hoc, textual data formats. Every lens program, when read from left to right, describes a function that maps an input to an output; when read from right to left, the very same program describes a "backwards" function that maps a modified output, together with the original input, back to a modified input.
Lenses have been used to solve problems across a wide range of areas in computing including: [...] in parsers and pretty printers
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 3143 bytes --]
next parent reply other threads:[~2010-12-09 11:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20101209110003.3C0B3BBAF@yquem.inria.fr>
2010-12-09 11:11 ` CUOQ Pascal [this message]
2010-12-09 4:47 Dawid Toton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5EFD4D7AC6265F4D9D3A849CEA92191902182AD9@LAXA.intra.cea.fr \
--to=pascal.cuoq@cea.fr \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox