adding compile pass

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

adding compile pass

Karlo Kuna
can one add custom compile pass when compiling module??


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Private message regarding: adding compile pass

Karlo Kuna
it's a shame, looking at source of compliler.erl this feature would be easy to add. Are you aware of any such proposal? Also it would be interesting to hear opinions on adding such proposal.

thank you 

On Wed, Apr 26, 2017 at 10:29 AM, Juan Facorro <[hidden email]> wrote:
On Saturday, April 22, 2017 at 8:58:59 PM UTC+1, Karlo Kuna wrote:
> can one add custom compile pass when compiling module??

It is not possible to arbitrarily insert a compiler pass in the Erlang compiler. Only parse transforms are currently available as a hook as a sort of preprocessing pass that handle Erlang AST.

Cheers,
Juan


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Private message regarding: adding compile pass

Richard Carlsson-3
You can add a core transform pass, just like a parse transform, but there is no support for adding passes below that level.

In the source file: -compile({core_transform,Module}).

or on the command line: erlc +'{core_transform,Module}'

will cause Module:core_transform(Code, Options) to be called during compilation.



        /Richard

2017-04-26 13:23 GMT+02:00 Karlo Kuna <[hidden email]>:
it's a shame, looking at source of compliler.erl this feature would be easy to add. Are you aware of any such proposal? Also it would be interesting to hear opinions on adding such proposal.

thank you 

On Wed, Apr 26, 2017 at 10:29 AM, Juan Facorro <[hidden email]> wrote:
On Saturday, April 22, 2017 at 8:58:59 PM UTC+1, Karlo Kuna wrote:
> can one add custom compile pass when compiling module??

It is not possible to arbitrarily insert a compiler pass in the Erlang compiler. Only parse transforms are currently available as a hook as a sort of preprocessing pass that handle Erlang AST.

Cheers,
Juan


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Private message regarding: adding compile pass

Juan Facorro-2

Nice! I didn't know about that one, obviously :P.


On Wed, Apr 26, 2017, 2:25 PM Richard Carlsson <[hidden email]> wrote:
You can add a core transform pass, just like a parse transform, but there is no support for adding passes below that level.

In the source file: -compile({core_transform,Module}).

or on the command line: erlc +'{core_transform,Module}'

will cause Module:core_transform(Code, Options) to be called during compilation.



        /Richard

2017-04-26 13:23 GMT+02:00 Karlo Kuna <[hidden email]>:
it's a shame, looking at source of compliler.erl this feature would be easy to add. Are you aware of any such proposal? Also it would be interesting to hear opinions on adding such proposal.

thank you 

On Wed, Apr 26, 2017 at 10:29 AM, Juan Facorro <[hidden email]> wrote:
On Saturday, April 22, 2017 at 8:58:59 PM UTC+1, Karlo Kuna wrote:
> can one add custom compile pass when compiling module??

It is not possible to arbitrarily insert a compiler pass in the Erlang compiler. Only parse transforms are currently available as a hook as a sort of preprocessing pass that handle Erlang AST.

Cheers,
Juan


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Private message regarding: adding compile pass

Karlo Kuna
thank you, 
i was looking something like command line version, although if would be nice to compile module programatically and non invasive (-compile option). 

On Wed, Apr 26, 2017 at 3:27 PM, Juan Martín <[hidden email]> wrote:

Nice! I didn't know about that one, obviously :P.


On Wed, Apr 26, 2017, 2:25 PM Richard Carlsson <[hidden email]> wrote:
You can add a core transform pass, just like a parse transform, but there is no support for adding passes below that level.

In the source file: -compile({core_transform,Module}).

or on the command line: erlc +'{core_transform,Module}'

will cause Module:core_transform(Code, Options) to be called during compilation.



        /Richard

2017-04-26 13:23 GMT+02:00 Karlo Kuna <[hidden email]>:
it's a shame, looking at source of compliler.erl this feature would be easy to add. Are you aware of any such proposal? Also it would be interesting to hear opinions on adding such proposal.

thank you 

On Wed, Apr 26, 2017 at 10:29 AM, Juan Facorro <[hidden email]> wrote:
On Saturday, April 22, 2017 at 8:58:59 PM UTC+1, Karlo Kuna wrote:
> can one add custom compile pass when compiling module??

It is not possible to arbitrarily insert a compiler pass in the Erlang compiler. Only parse transforms are currently available as a hook as a sort of preprocessing pass that handle Erlang AST.

Cheers,
Juan


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions




_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions