[antlr-interest] ANTLR 3 and StringTemplate
Scott Amort
jsamort at gmail.com
Mon Jul 24 14:16:58 PDT 2006
Hi Kay,
Kay Roepke wrote:
>
> On 22. Jul 2006, at 21:40 Uhr, Scott Amort wrote:
>
>> Should I instead just implement an
>> alternative in C++ (although this seems like reworking the wheel
>> considering how useful StringTemplate appears to be)? Finally, will
>> ANTLR 3 with its use of StringTemplate offer any solutions?
>
> You could do a C++ port of StringTemplate, instead of doing
> yet-another-template-thingy ;)
> v3 has support to directly use templates and assign values to template
> variables from within your grammar.
> This works similarly to AST support. Obviously this feature is only
> available to targets that have
> a native ST implementation available.
Right... makes sense. I certainly considered the C++ port option. I'll
have to look a bit closer at the StringTemplate code and see what I'd be
getting myself into :-)
> If you don't mind the performance hit, you could try to interface with a
> language such as Java or Python.
> Especially Python should be easy (*I think* there is a C++ bridge for
> Python). That wouldn't give you the template output
> of v3, but you'd be able to use ST via your own code (or in actions).
This seems like a not-too bad tradeoff, especially in the short term. I
have done some research, and am thinking of Python together with
Boost.Python. I will likely go this route and investigate a C++ port
for a better long-term solution.
Thanks,
Scott
More information about the antlr-interest
mailing list