caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Define parser and printer consistently
@ 2010-12-09  4:47 Dawid Toton
  2010-12-09  4:56 ` [Caml-list] " Ashish Agarwal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dawid Toton @ 2010-12-09  4:47 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-09 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09  4:47 Define parser and printer consistently Dawid Toton
2010-12-09  4:56 ` [Caml-list] " Ashish Agarwal
2010-12-09 11:25 ` Romain Bardou
2010-12-09 19:28 ` Yitzhak Mandelbaum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).