From: "David Allsopp" <dra-news@metastack.com>
To: "'Paolo Donadeo'" <p.donadeo@gmail.com>,
"'OCaml mailing list'" <caml-list@yquem.inria.fr>
Subject: RE: [Caml-list] Parsing simple type expressions
Date: Tue, 6 Jan 2009 15:12:31 -0000 [thread overview]
Message-ID: <007001c97011$33012dc0$99038940$@com> (raw)
In-Reply-To: <4b5157c30901060603k6d0589d2m469b170dc5ec7c8e@mail.gmail.com>
ocamlyacc - you can get most of it for free out of parsing/parser.mly in the OCaml sources... the section on type expressions starts at line 1144 for OCaml 3.11.0.
David
> -----Original Message-----
> From: caml-list-bounces@yquem.inria.fr [mailto:caml-list-
> bounces@yquem.inria.fr] On Behalf Of Paolo Donadeo
> Sent: 06 January 2009 14:04
> To: OCaml mailing list
> Subject: [Caml-list] Parsing simple type expressions
>
> 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
>
> _______________________________________________
> 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
next prev parent reply other threads:[~2009-01-06 15:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-06 14:03 Paolo Donadeo
2009-01-06 15:12 ` David Allsopp [this message]
2009-01-06 21:10 ` [Caml-list] " 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
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='007001c97011$33012dc0$99038940$@com' \
--to=dra-news@metastack.com \
--cc=caml-list@yquem.inria.fr \
--cc=p.donadeo@gmail.com \
/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