When do we use ANTLR
The Antlr package is used by the WebGrease package. The WebGrease package is used by the ASP.NET Web Optimization package.
If you want to remove Antlr, remove the ASP.NET Web Optimization package. It will in turn remove the other 2 packages.
It does not affect performance much, provided that you designed your application properly.
The ASP.NET Web Optimization package has a dependency on WebGrease which in turn has a dependency on Antlr. If you want to remove Antlr you must remove ASP.NET Web Optimization. So the question now becomes:
What is the ASP.NET Web Optimization package used for in a new MVC project?
It is used to bundle and minify the .css
and .js
resources. In a new ASP.NET MVC web project there is a file named /App_Start/BundleConfig.cs
where the bundles are defined. For example:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css", "~/Content/site.css"));
// etc.
In the /Views/Shared/_Layout.cshtml
these defined bundles are then added to the returned view.
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery")
So if you remove these references you will have to use a different strategy/tool to bundle/minify your dependencies like gulp with gulp-concat and gulp-uglify.
You would need these dll's if you are parsing any text at runtime using an antlr grammar.
Typically there are two steps.
1) run the java antlr parser over your .g files to generate a C# lexer, C# grammar and possibly C# tree walkers.
2) Build those files into your application. Those files will work in conjunction with the antlr.runtime dll, or antlr3.runtime dll if you're using ANTLR version 3.
Your C# program can now parse text files using the grammar that you compiled in step 1.
ANTLR is a parser generator that is able to generate parsers in multiple languages including C#. The ANTLR homepage is here.
The creator Terence Parr has also published a book, The Definitive ANTLR Reference.