From: Christian Stork <caml-list@cstork.org>
To: caml-list@inria.fr
Subject: Camlp4 question on type declarations
Date: Wed, 13 Jun 2007 22:38:04 -0700 [thread overview]
Message-ID: <20070614053803.GA20489@stirner.roentgeninstitut.de> (raw)
I'd like to construct a quotation that acts as the following pattern.
Ast.StTyp (_, (Ast.TyDcl (_, name, params, t, _)))
How can I do this? The obvious attempt
<:str_item< type $lid:name$ $list:params$ = $t$ >>
doesn't work because the 'list' antiquotation expander is not supported
(and AFAIU would be against the "spirit" of the overhault camlp4, altho
I wouldn't know why in this case).
There seem to be two problems. First, if one writes
<:str_item< type $lid:name$ $params$ = $t$ >>
(without the 'list:') then this pattern only matches a single parameter.
<:str_item< type $name_and_params$ = $t$ >>
doesn't work, even though one could think of name_and_params as a single
ctyp where name is applied to the params. (Wouldn't that be more
consistet with the modeling of type application in the rest of camlp4?)
Second problem: the above patterns only match type declarations without
any constraints. Something like
<:str_item< type $lid:name$ $param$ = $t$ $_$ >>
doesn't work either. (Admittedly, that would be hard to decypher
anyway.) The following only matches exactly one constraint.
<:str_item< type $lid:name$ $param$ = $t$ constraint $_$ = $_$ >>
Any solutions or do I have to fall back on using the underlying AST
constructors?
--
Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F
next reply other threads:[~2007-06-14 5:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-14 5:38 Christian Stork [this message]
2007-06-23 16:09 ` [Caml-list] " Nicolas Pouillard
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=20070614053803.GA20489@stirner.roentgeninstitut.de \
--to=caml-list@cstork.org \
--cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).