From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 6BE16800B6 for ; Mon, 3 Jun 2013 13:05:43 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of kosmo.zb@gmail.com) identity=pra; client-ip=209.85.217.171; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of kosmo.zb@gmail.com designates 209.85.217.171 as permitted sender) identity=mailfrom; client-ip=209.85.217.171; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f171.google.com) identity=helo; client-ip=209.85.217.171; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="postmaster@mail-lb0-f171.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8BAGp9q1HRVdmrlGdsb2JhbABasB6TEQgWDgEBAQEHCwsJEiqCURkBOQMNBRBdEgEFAVCHYAMPmjyCfo9HhAMnDUuIMgEFDI84g0IDlz6PWxYpgV2CWTs X-IPAS-Result: Ah8BAGp9q1HRVdmrlGdsb2JhbABasB6TEQgWDgEBAQEHCwsJEiqCURkBOQMNBRBdEgEFAVCHYAMPmjyCfo9HhAMnDUuIMgEFDI84g0IDlz6PWxYpgV2CWTs X-IronPort-AV: E=Sophos;i="4.87,789,1363129200"; d="scan'208";a="16483999" Received: from mail-lb0-f171.google.com ([209.85.217.171]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Jun 2013 19:19:25 +0200 Received: by mail-lb0-f171.google.com with SMTP id v5so303444lbc.16 for ; Sun, 02 Jun 2013 10:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=DLCPcZ1euutbHUaIyBG04g+azxi8wk7FXeiiVy3fZ1s=; b=Vpp+YGjw2AveUO5gIAVAnzyyUn2bHq0tZWDx/d1TWODNrrpWuOMpsluEW9wAeOTOpY u/QpoigU+waE2UEiV9tsp+SakT3hba0Sb251vCNLfUilXqSgLUl9JD60nz0ysReTGaQB Tf1fyPXbu6bmeLXWIiiqaAzXPQNLQUpesatW8/GfNtbu2n829/YI/y8qXkYiLWL4+MiM eCBebRYZ/Ba8D8CU6cepclLuWz0/T+duIsdRMPiofYjLnjnQo7vgebyoZdoqTlYbwTAh cz9mvdT5NJOsNlKkvnibF5ZPUeyGQKEsCwzGRD4HltWBqPiCqWqV6Lx+pBIJKsLGsOIe 2TRw== MIME-Version: 1.0 X-Received: by 10.152.21.40 with SMTP id s8mr9445290lae.6.1370193564699; Sun, 02 Jun 2013 10:19:24 -0700 (PDT) Sender: kosmo.zb@gmail.com Received: by 10.112.158.10 with HTTP; Sun, 2 Jun 2013 10:19:24 -0700 (PDT) Date: Sun, 2 Jun 2013 18:19:24 +0100 X-Google-Sender-Auth: yKsTYgd-IQn8O2_p7fza4w-8m9I Message-ID: From: David Sheets To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: [Caml-list] Deepest Lexically Faithful OCaml Syntax Folds 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