toker – Pluggable parsers for the Erlang compiler
Pluggable parsers for the Erlang compiler
This project started as an experiment with runtime code injection using the parse_trans library.
(Note, ‘Toker’ is the Swedish name for Dopey the dwarf, but also obviously a word play refering to token transformation.)
This library installs itself into the Erlang compiler, allowing modules to switch parser modules as well as install token transformers.
Example: the toker_test module uses a custom syntax:
lists:map(`(X) -> X*2`, L).
This module will not compile with the standard Erlang parser, but toker’s own build chain bootstraps itself and installs a hook in the erl_parse module, which then detects the instruction -toker_parser(toker_erl_parse)
Eshell V5.10.3 (abort with ^G)
Contributions are welcome, although the library is mostly for fun (it’s been gathering dust for a while, and I thought I’d at least publish it).
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.