[antlr-interest] Need some advice which ANTLR versions should be used for my project (Target: Java or Python)

The Researcher researcher0x00 at gmail.com
Thu Sep 15 07:29:45 PDT 2011


Hi Stefan,

FWIW

Each of the different target languages is created and maintained by
different people/groups. See
http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets

If you check http://www.antlr.org/wiki/display/ANTLR3/Antlr3PythonTarget you
will see "Please note that the Python target is (compared to most other
targets) rather young. I would consider it to be in *beta state*."

Since Terence creates and maintains the Java version, the decision is
obvious; pick the Java target.

My guess is that most of your work will be in creating a PERL grammar for
ANTLR and doing the AST rewrites. You will probably need to write some Java
for the  predicates but that will be a lesser of your worries. Note: I did
not find a PERL grammar at http://www.antlr.org/grammar/list

Best Wishes, Eric

On Thu, Sep 15, 2011 at 9:43 AM, Stefan Mätje (d) <
Stefan.Maetje at esd-electronics.com> wrote:

> Hi,
>
> I'm facing the task to build a language to language translator that should
> translate the programming language PEARL to C++. The idea is to build a
> combined grammar to build an AST and then output the C++ code using a tree
> grammar with StringTemplate.
>
> At a first glance I picked the Python target to be used as the language the
> translator could be written in. This was because some of my colleagues have
> some experience in Python. Another benefit would be that the translater
> would
> run unchanged under Windows and Linux because of its "interpreted" nature.
>
> Another usable target language would be Java. Unfortunately I have neither
> experience with Python nor Java except some 100 lines example programs.
>
> With the Python target there seem to be some uncertainties with the tool
> chain.
>
> >From the Python target language page I get the impression that I have
> to stick to ANTLR V3.1.3 if I want to use the Python target. On the other
> hand
> the current AntlrWorks version 1.4.3 uses an Antlr V3.4.
>
> Is anybody here who could tell me if I must use Antlr 3.1.3 to avoid any
> problems or if I could use Antlr 3.4 (from AntlrWorks) without deeper
> thinking?
>
> Is the Python runtime compatible with Antlr 3.4 output? (Last question
> already
> answered by Python runtime page
> @http://www.antlr.org/wiki/display/ANTLR3/Python+runtime)
>
>
> Also in the last stage of my translator I'll need the StringTemplate
> library.
> Have there been any updates or are the things mentioned on the Python
> target
> page still valid?
>  - Python port of StringTemplate is compatible to V3.1
>  - needs Python runtime from antlr-2.7.7
>
>
> On the other hand the Java target would offer much more example code (from
> the
> books and the wiki) but if I would use Java I would be on my own (no
> fellows
> working with Java in my company). Also I could use an up-to-date Antlr
> version, but I don't know what the possible benefits would be.
>
> Any comments and advice to choose the target language and which Antlr /
> Antlrworks / Stringtemplate versions to use appreciated.
>
> Thanks,
>        Stefan Mätje
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list