<div dir="ltr"><div><div>Hi David,<br><br></div>You should be able to do that with a parse_transform/2. Look up parse transform: you basically get to implement a function which the compiler calls at compilation time passing it a formal representation of the source code it's compiling (a.k.a abstract forms... though I'm not entirely sure about the terminology).<br>
<br></div><div>You can then use the erl_syntax module to manipulate these forms.<br></div><div><br></div>cheers,<br>Justin<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 8 April 2013 08:21, Anthony Ramine <span dir="ltr"><<a href="mailto:n.oxyde@gmail.com" target="_blank">n.oxyde@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello David,<br>
<br>
A fancy way to extend the Erlang syntax would be to have something like Camlp4, a powerful and extensible preprocessor for OCaml. It has a powerful quotation system which it itself uses to implements its parser construct, to extend OCaml's syntax at compile-time. I have began writing a quotation system for Erlang but didn't have the time finish it yet [1].<br>

<br>
Regards,<br>
<br>
[1] <a href="https://github.com/nox/otp/tree/brackets" target="_blank">https://github.com/nox/otp/tree/brackets</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Anthony Ramine<br>
<br>
Le 8 avr. 2013 à 02:12, David Goehrig <<a href="mailto:dave@nexttolast.com">dave@nexttolast.com</a>> a écrit :<br>
</font></span><div class="im HOEnZb"><br>
> Next step is integrating into the stack better. But the question remains, what is the best way to add a new operator.<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>