Antlr3, docs & StringTemplate

26 views
Skip to first unread message

burt_...@hotmail.com

unread,
Nov 10, 2016, 8:08:07 PM11/10/16
to antlr-discussion
I've been looking at the source-code for [StringTemplate4](https://github.com/antlr/stringtemplate4), in particular, the [STParser](https://github.com/antlr/stringtemplate4/blob/master/src/org/stringtemplate/v4/compiler/STParser.g) grammar.   I was surprised to find that it's written in a version of ANTLR I no longer remember (ANTLR3 I believe.)   The ANTLR4 tool was surprised too, and repeatedly said so.


error(50): STParser.g4:145:6: syntax error: '->' came as a complete surprise to me while looking for rule element

That's a laugh.   Anyway, I figured no problem: I'll just go back and look at the docs to refresh myself as to the meaning of these arrows.   But when I tried to do so, it seems like the ANTLR3 docs aren't where they used to be.   Links in the [antlr3 git repository](https://github.com/antlr/antlr3) point to locations which no longer contain the docs (e.g. http://www.antlr.org/wiki/display/ANTLR3/ANTLR+3+Wiki+Home).    While I'm sure I've got a copy of the previous edition of Terry's book somewhere around the house, it seems a shame that the online docs aren't accessible via the old URLs.

I also found a the set of [ANTLR4 grammars for StringTemplate](https://github.com/antlr/grammars-v4/tree/master/stringtemplate), but comparing them against the original, it seems there may be more differences than I expected.   For example, comparing the old definition of [`element`](https://github.com/antlr/stringtemplate4/blob/master/src/org/stringtemplate/v4/compiler/STParser.g#L76) with the example [`element`](https://github.com/antlr/grammars-v4/blob/master/stringtemplate/STParser.g4#L50) I see the original dealing with symbols like INDENTED_EXPRESSSION and INDENT, while the newer grammar doesn't seem to deal with indentation at all.  

I'm looking for a little more context.   Has anyone implemented a version of StringTemplate using the ANTLR4 grammar?   Is the example intended (or tested) to be compatible with StringTemplate4?
Reply all
Reply to author
Forward
0 new messages