From: David Sheets <sheets@alum.mit.edu>
To: caml-list@inria.fr
Subject: [Caml-list] Re: Deepest Lexically Faithful OCaml Syntax Folds
Date: Mon, 3 Jun 2013 21:42:58 +0100 [thread overview]
Message-ID: <CAAWM5TxCEFNbF0h8qZwtRNRo4qNUvRXRxtFBUq=hSsD5qdHAAQ@mail.gmail.com> (raw)
In-Reply-To: <CAAWM5Tzrg-JBNqCf8T2sa=idDu7rDfy0zUuJsK9GZDX3Q6V-iw@mail.gmail.com>
I've been told that my attempt at mathematical precision made my
original request difficult to understand. Please, permit me to try
again and forgive my earlier nonsense:
I am looking for a way to annotate OCaml source code while retaining
as much original source code layout as possible.
Specifically, I would like to have access to as much of the semantic
information about the source's components as possible while still
retaining token locations suitable for high-quality serialization.
Why do I want this?
To colorize OCaml source in terminal output.
To annotate OCaml source with XML/HTML.
To expand and rewrite references in OCaml comments with very clean
resulting diffs.
Do you know of an OCaml source preprocessor that has properties which
would make creation of these tools easy? Do you know of tools that
already do some of the above things? Do they do it well?
Thanks,
David
On Sun, Jun 2, 2013 at 6:19 PM, David Sheets <sheets@alum.mit.edu> wrote:
> Hello World,
>
> I am searching for the "deepest lexically faithful OCaml syntax
> catamorphism solution" as the title indicates. What precisely do I
> mean by this?
>
> Deepest => most semantically abstract while retaining a map back to syntax
> Lexically faithful => injective, accurate, coordinate-tracked tokens
> OCaml syntax => a fine conjuring form
> Catamorphism => the source annotations occur as reserialization folds
> of some kind
> Solution => relatively cheap to integrate
>
> Specifically, I am looking for a collection of functions like:
>
> ana ocaml_parse : string -> '_a
> cata : '_a -> (('_a -> '_b) * ('_b list -> '_b)) -> '_b
> cata' : '_b -> (('_b -> '_c) * ('_c list -> '_c)) -> '_c
> .
> .
> .
> serialize : '_c -> ('_c -> string) -> string
>
> where ana's domain is OCaml source code and cata''s range is (possibly
> annotated) OCaml source (which may not be valid for reconsumption
> without further processing). The multiplication operator's signature
> may vary.
>
> such that the weakly polymorphic types above can be mapped over by
> adding arbitrary annotations. Any number of catamorphic levels is
> acceptable. OCaml 3.12 and 4.x syntax support necessary.
>
> Is the answer some invocation of camlp4, ppx, fan, or compiler
> internals? Am I asking for something nonsensical? Have you already
> implemented something similar? Do functions equivalent to these exist
> in a tool of which you know?
>
> Thank you,
>
> David
prev parent reply other threads:[~2013-06-03 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-02 17:19 [Caml-list] " David Sheets
2013-06-03 20:42 ` David Sheets [this message]
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='CAAWM5TxCEFNbF0h8qZwtRNRo4qNUvRXRxtFBUq=hSsD5qdHAAQ@mail.gmail.com' \
--to=sheets@alum.mit.edu \
--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