[wg-camlp4] Some challenges when ast rewriter is widely used

Hongbo Zhang hongboz at seas.upenn.edu
Thu Jan 31 04:41:31 GMT 2013


Dear all,

    I summarized some possible pitfalls people may encounter here(Ast
Rewriter is also freely available
in Fan but used only in some areas similar to  *bisect*):

* *   1. composition semantics unclear
        suppose we have three plugins A, B, C  which does the Ast rewriting.
        What's the difference between the composition A.B.C  and B.C.A?
        Suppose A a very naive plugin to remove all the unsafe expression,
but B happens to
        introduces an unsafe expression? What should we expect here?

    2. compiling performance downgrading
       so far, Ast Rewriter is always doing global ast transformation which
does a lot of un-necessary transformation,
       suppose you have a series of plugins which does global
transformation ? Maybe it could be improved, but I don't
       see a clever way to fuse plugins.

    3. inconsistent semantics between compiling and toplevel module
        we could also do the Ast transformation in the toplevel, but the
semantics is a bit different, this is also due to the fact
        that we are doing global transformation

    4. upgrading compatibility
        I suggest introducing an Intermediate Ast (for lots of good reasons
I ever mentioned), if we *expose* too much compiler
        API, any change will break all existing plugins. Even though you
use some nice utility like ast_mapper, people
        still use the Constructor name explicitly.
-- 
-- Regards, Hongbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-camlp4/attachments/20130130/e7e36146/attachment.html>


More information about the wg-camlp4 mailing list