From: "Conglun Yao" <yaoconglun@gmail.com>
To: caml-list@yquem.inria.fr
Subject: camlp4 questions
Date: Fri, 4 Apr 2008 08:59:09 +0100 [thread overview]
Message-ID: <f7b50d2a0804040059j68074f09xea2dd02407508ce0@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]
Hi,
While doing my little camlp4 (3.10) practice, I had the following questions:
(1) Is there a simple approach to add some 'open' directive at the beginning
of file.
I know in camp4 (3.09), it could be achieved by modifying
Pcaml.parse_implem.
Pcaml.parse_implem :=
fun strm ->
let (sils, stopped) = Grammar.Entry.parse Pcaml.implem strm in
let enhanced_sils = ..... (* modify sils *)
(enhanced_sils, stopped);
How can I achieve the same effect in 3.10.
(2) How to extend operators like '@', for example if I want to change the
expression
list_1 @ list_2 => List.append list_1 list_2
In 3.09, it could be achieved by deleting rules
DELETE_RULE Gram expr: SELF; "@"; SELF END
however, in 3.10, it seems I can't find the above grammar, only can find in
Camlp4OCamlParser.ml
expr: AFTER "^"
[ "::" RIGHTA
[ e1 = SELF; "::"; e2 = SELF -> <:expr< [$e1$ :: $e2$] >> ]
];
Furthermore, if I want to extend the expr: "["; sem_expr_for_list; "]",
where to find the rule definition.
In 3.09, all of these exist in pa_o.ml
Any suggestion is welcome and appreciated.
Conglun
[-- Attachment #2: Type: text/html, Size: 1386 bytes --]
next reply other threads:[~2008-04-04 7:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-04 7:59 Conglun Yao [this message]
2008-04-04 8:38 ` [Caml-list] " Richard Jones
2008-04-04 9:56 ` Conglun Yao
2008-04-04 13:42 ` Nicolas Pouillard
-- strict thread matches above, loose matches on Subject: below --
2007-07-23 9:46 Christophe Raffalli
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=f7b50d2a0804040059j68074f09xea2dd02407508ce0@mail.gmail.com \
--to=yaoconglun@gmail.com \
--cc=caml-list@yquem.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