views:

213

answers:

3
+4  Q: 

Erlang and Antlr

Is it possible to write an Antlr code generation target for Erlang?

+1  A: 

Erlang comes with its own parse tools. They use their own syntax though, so you cant take a grammar file from antlr.

Christian
A: 

Sure, ANTLR is general purpose. If you really wanna do that, you should take a look at the Core Erlang language specification. Be warned that it is quite old, but should be okay for a starter.

Zed
It is **much** nicer to generate Core erlang than normal erlang as it is a smaller simpler language. I do it for LFE. The main problem is that it is not as stable as erlang as they tend to view it as an internal compiler pass. I am trying to get them to change that though.
rvirding
+2  A: 

It depends what you mean. If you mean you want to generate parser & lexer source files in Erlang, then no, this is not possible (at least, not out of the box*). Checkout the current list of targets for ANTLR: http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets

* You could be the one implementing it, of course. But that's no trivial task!

Bart Kiers