antlr / antlrcs

The C# port of ANTLR 3, StringTemplate 3, and StringTemplate 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is StringTemplate for C# a dead project?

nlyk opened this issue · comments

commented

Should I use StringTemplate (C# target) in a new project? Please advise

ANTLR 4 replaced ANTLR 3 a long while ago, so you should switch to https://github.com/antlr/antlr4/tree/master/runtime/CSharp/src

commented

@lextm Sorry I was not clear - I am particularly interested in the StringTemplate project and specifically in the C# target.

StringTemplate remains 4.x, https://www.stringtemplate.org/ So this repo already contains the latest C# port (4.x).

As a library of very specific features, I don't see a need of frequent updates. It will be your own judgement whether to use it in a new project.

commented

Last stable version of ST4 is 4.3.1 (Jun 2020). ST4 C# last stable version is 4.0.8, since Dec 2016 (https://www.nuget.org/packages/StringTemplate4). Are all the fixes and new features after 4.0.8 not relevant to C# port? I doubt that.
Is there any known roadmap?

I was wondering myself. For my dotnet-antlr project, I create an Antlr driver from grammars and source code. Right now, my tool generates code via Console.WriteLines. I always assumed that I could rewrite it with ST, but when I went to look at it a few days ago, I found that this code doesn't even open or build in VS2019, and it uses ancient framework targets rather than Netstandard2.0. I was able to rip out large sub-projects and get it to compile in a few hours of work. ST is dependent on Antlr3--a liability in this code, and in the Java version--so I will try to use the official Java Antlr3 tool rather than the tool in this repo. I have no idea if any of this will work.

My fork of ST4 C# is here: https://github.com/kaby76/stringtemplate4cs It builds in VS2019 and is targeted to netstandard2.0. I made a simple "hello world" program that uses it and it works. Much to do in bringing it up to date.

@lextm Yes, good info. So, this repo is the one to fix. The copy I forked at (https://github.com/kaby76/stringtemplate4cs) is working. It handles everything I need, including "attributes", "properties", "map". I don't use groups, but I assume it will work for that, too. StringTemplate.ST is really StringTemplate.Template in the C# API, so the doc is behind. But, it's really the only way to go. ST is a very useful project.

Yeah, unfortunately, it's dependent on Antlr3. I noticed that it uses the parse tree construction annotation of Antlr3 to get an AST, but it looks like it is then compiled into some kind of byte code for an interpreter. In the long run, the Antlr3 dependency should just be replaced with Antlr4 so as to have one less thing to maintain.

I have been using ANTLR over many, many years on many occasions.
It is very sad to see this extremely valuable project ending up like this - mixed up and confusing versioning, all dumped to a single repo, just two usual contributors, no future. I think, practically speaking, yes - it is dead.
It has not been decided to let it live :/

Yes, StringTemplate for C# is now mostly unmaintained. That is why I have a fork of the giant code base antlrcs, stripped out StringTemplate, and placed it here https://github.com/kaby76/Domemtech.StringTemplate4 . I have brought that code somewhat up to date with some bug fixes from the Java code base. And I use StringTemplate C# extensively in trgen. I haven't updated the grammar to Antlr4, but it should be. The main sticking point is that the grammar for StringTemplate is stuck in Antlr3 cause Antlr4 doesn't have Ast tree construction. I have been working on a preprocessor for Antlr4 grammars that reintroduce ast tree operators, but I need to first have an Xslt-like rewrite tool for antlr trees (trpiggy).

@kaby76 My sincere thanks for taking the action, although I found no signs the original authors' appreciation.