Main Content

Erlang metaprogramming made easy

About the Talk

March 30, 2012 1:15 PM

Marines’ Memorial Club & Hotel 609 Sutter Street San Francisco

Marines’ Memorial Club & Hotel 609 Sutter Street San Francisco

To generate Erlang code dynamically, you have until now had two choices: you could either create plain tuples according to the "abstract format" as generated by erl_parse (which is messy and has many special cases to keep in mind), or you could use the API functions in the erl_syntax module (which offer more abstraction, but can get pretty verbose). This talk will present the missing ingredient; a library allowing you to use template strings with metavariables, both for generating and matching on abstract syntax trees. As examples, I will show how we have used this at Klarna to implement a small domain-specific language for business logic, and demonstrate how you too can easily write a parse transform and even implement your own DSL that compiles to Beam code.

Talk objectives: Blowing a few minds.

Target audience: Anyone who wants to generate Erlang modules at run-time, for example for implementing a DSL or a parse transform.

Ratings and Recommendations

Avg. Rating

Average based
on 1 rating

comments powered by Disqus