From: John Harrison <John.Harrison@cl.cam.ac.uk>
To: caml-list@pauillac.inria.fr
Cc: John.Harrison@cl.cam.ac.uk
Subject: Installing parsers and printers
Date: Tue, 22 Mar 94 14:55:52 +0000 [thread overview]
Message-ID: <"swan.cl.cam.:265930:940322145613"@cl.cam.ac.uk> (raw)
My interest in CAML is as a metalanguage for an embedded logic (which was of
course ML's original application, hence the name). An important part of this is
the provision of a nice interface to the user who still uses the toplevel loop,
so I have two wishes:
o I'd like to be able to install a custom printer to display objects of a
nominated type (in the toplevel loop). I have a logic encoded as a
recursive type. Of course this is unreadable in its raw form, and it's
very tedious to have to call a prettyprinter explicitly. Ideally I'd
like to be able to do something like:
#install_printer "term" "term_printer";;
(where `term_printer' is an ML function I have defined), and then have all
objects of type `term' displayed using that printer. If something this clean
is not possible I'm willing to dive into C if somebody can advise me on how
to interface to the system.
o I'd like to be able to set up some special quotation syntax to parse
down to a nominated type automatically. I envisage something like:
#install_parser "<<" ">>" "term_parser";;
(where `term_parser' is an ML function I have defined). Thereafter if I
type <<....>>, the system would call the parser on the string "...." and
that would be the result of evaluation.
If this is not possible, then I can survive by invoking a parser explicitly
on a string. However I would really like to suppress recognition of escapes
like "\n" in this string. Is there a clean way of forcing this, or does
it necessitate patching the lexer?
It is interesting to note that SML/NJ originally had no such facilities, but
they have been added by Konrad Slind -- see his paper in the Second ML
Workshop: "Object Language Embedding in Standard ML of New Jersey".
I'd be grateful for any help,
John.
next reply other threads:[~1994-03-22 16:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-03-22 14:55 John Harrison [this message]
1994-03-22 16:20 Pierre Weis
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='"swan.cl.cam.:265930:940322145613"@cl.cam.ac.uk' \
--to=john.harrison@cl.cam.ac.uk \
--cc=caml-list@pauillac.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