From: Alain Frisch <frisch@clipper.ens.fr>
To: Caml list <caml-list@inria.fr>
Subject: [Caml-list] Camlp4: syntax extension in source file
Date: Fri, 25 Oct 2002 00:33:48 +0200 (MET DST) [thread overview]
Message-ID: <Pine.SOL.4.44.0210250021500.1813-100000@clipper.ens.fr> (raw)
Hello,
This thread about macro definition with Camlp4 reminds me of an idea I had
some time ago. The idea is to use the Toplevel lib to introduce Caml
syntax extension directly inside source file. Something like that:
SYNTAX
let x = ....
EXTEND
expr: [ .... ];
END
END
The code between SYNTAX and END is parsed, compiled and executed by Camp4
during the preprocessing phase; it modifies the syntax used to parsed the
remaining of the rest of the file (including perhaps following SYNTAX ...
END statements). This allows a limited kind of reflexivity: the source
file describes its own syntax. It also gives the possibility to perform
some computations at compile time (the "x" above).
I cannot remember why I didn't succeed to make it work (I think I had
some problems because of limitations in what the toplevel library
exports).
Daniel - and others - do you believe the above proposition makes sense ?
-- Alain
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next reply other threads:[~2002-10-24 22:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-24 22:33 Alain Frisch [this message]
2002-10-25 9:39 ` Daniel de Rauglaudre
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=Pine.SOL.4.44.0210250021500.1813-100000@clipper.ens.fr \
--to=frisch@clipper.ens.fr \
--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