[erlang-questions] about syntax tools

Richard Carlsson carlsson.richard@REDACTED
Fri Aug 5 11:38:37 CEST 2011


On 08/05/2011 11:32 AM, Andrew Kondratovich wrote:
> Hello.
>
> How can i add some syntax expressions in language without editing
> source grammatics ?
>
> For example, i want to add something like list generator:
> [1..6] % generates [1,2,3,4,5,6]
>
> Can i add my own syntax rules by syntax tools or something like that ?

No, you can't modify the grammar. You can however use parse transforms 
to change the meaning of some expressions, e.g. like mnesia query list 
comprehensions change the meaning of calls to qlc:q(...). See 
http://www.erlang.org/doc/man/compile.html for some more info. (You can 
use syntax_tools to help you write parse transforms, though.)

     /Richard



More information about the erlang-questions mailing list