You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5634 Reporter:@alainfrisch Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:04:56Z) Resolution: fixed Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general) Monitored by:@gasche@glondu@hcarty
Bug description
I believe many Camlp4 syntax-extension could be implemented with a much more basic technology. I've described a proposal for extending the OCaml syntax with a fixed number of extension points (attributes and quotations) and letting the compilers pipe the parsed AST through one or several external rewriters:
Now that "compilerlibs" are officially installed, and as a first step towards this proposal, I'd like to propose for inclusion the tiny attached patch (also in the ast_rewriter branch of the SVN). It only extends the compilers with a new "-ppx" flag, similar to (and compatible with) the existing "-pp". Invoking the compiler with "-ppx cmd" pipes the parsed AST (interface/implementation) through the specified command (actually, it passes two filenames -- input and ouput -- as extra arguments to the command).
An example of how to write an AST rewriter is available in the SVN:
Original bug ID: 5634
Reporter: @alainfrisch
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:04:56Z)
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche @glondu @hcarty
Bug description
I believe many Camlp4 syntax-extension could be implemented with a much more basic technology. I've described a proposal for extending the OCaml syntax with a fixed number of extension points (attributes and quotations) and letting the compilers pipe the parsed AST through one or several external rewriters:
http://www.lexifi.com/blog/syntax-extensions-without-camlp4
Now that "compilerlibs" are officially installed, and as a first step towards this proposal, I'd like to propose for inclusion the tiny attached patch (also in the ast_rewriter branch of the SVN). It only extends the compilers with a new "-ppx" flag, similar to (and compatible with) the existing "-pp". Invoking the compiler with "-ppx cmd" pipes the parsed AST (interface/implementation) through the specified command (actually, it passes two filenames -- input and ouput -- as extra arguments to the command).
An example of how to write an AST rewriter is available in the SVN:
http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/ast_rewriter/experimental/frisch/
File attachments
The text was updated successfully, but these errors were encountered: