caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Parsing simple type expressions
@ 2009-01-06 14:03 Paolo Donadeo
  2009-01-06 15:12 ` [Caml-list] " David Allsopp
  2009-01-06 18:19 ` Jake Donham
  0 siblings, 2 replies; 7+ messages in thread
From: Paolo Donadeo @ 2009-01-06 14:03 UTC (permalink / raw)
  To: OCaml mailing list

For a serializer I'm writing I need to parse simple OCaml type
expressions composed by OCaml basic types, tuples, options and lists.
Given a string like "(int * string option) list" and this type:

type types =
  | Int
  | String
  | Float
  | Char
  | Bool
  | Option of types
  | List of types
  | Tuple of types list

the function I need should return something like List (Tuple ([Int;
Option(String)]))

Before starting with low level sscanf functions I looked at the Genlex
module, but it wasn't so inspiring. Then I tried with Camlp4 but the
documentation doesn't really shine :-)

So is there a simple way to write this function using some standard module?

TIA,


-- 
Paolo
~
~
:wq


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

end of thread, other threads:[~2009-01-07 22:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-06 14:03 Parsing simple type expressions Paolo Donadeo
2009-01-06 15:12 ` [Caml-list] " David Allsopp
2009-01-06 21:10   ` Martin Jambon
2009-01-06 22:49     ` Re : " Matthieu Wipliez
2009-01-07 22:50       ` Paolo Donadeo
2009-01-06 18:19 ` Jake Donham
2009-01-06 21:00   ` Paolo Donadeo

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).