-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is StringTemplate for C# a dead project? #129
Comments
ANTLR 4 replaced ANTLR 3 a long while ago, so you should switch to https://github.com/antlr/antlr4/tree/master/runtime/CSharp/src |
@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. |
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. |
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. |
Related to tunnelvisionlabs/antlr4cs#341 |
@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. |
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. |
Should I use StringTemplate (C# target) in a new project? Please advise
The text was updated successfully, but these errors were encountered: