Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Ashish Agarwal <agarwal1975@gmail.com>
To: Dawid Toton <d0@wp.pl>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Define parser and printer consistently
Date: Wed, 8 Dec 2010 23:56:43 -0500	[thread overview]
Message-ID: <AANLkTik6YmgDr+Mp-NqjTNoqjifOtdJOk=jKDkKG=b50@mail.gmail.com> (raw)
In-Reply-To: <4D005F51.8070701@wp.pl>

[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]

Maybe you will find Pickler Combinators useful:
http://research.microsoft.com/en-us/um/people/akenn/fun/picklercombinators.pdf


On Wed, Dec 8, 2010 at 11:47 PM, Dawid Toton <d0@wp.pl> 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
>

[-- Attachment #2: Type: text/html, Size: 1879 bytes --]

  reply	other threads:[~2010-12-09  4:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09  4:47 Dawid Toton
2010-12-09  4:56 ` Ashish Agarwal [this message]
2010-12-09 11:25 ` [Caml-list] " Romain Bardou
2010-12-09 19:28 ` Yitzhak Mandelbaum

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='AANLkTik6YmgDr+Mp-NqjTNoqjifOtdJOk=jKDkKG=b50@mail.gmail.com' \
    --to=agarwal1975@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=d0@wp.pl \
    /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