![]() |
VOOZH | about |
dotnet add package AnglrParserLibrary --version 1.0.7
NuGet\Install-Package AnglrParserLibrary -Version 1.0.7
<PackageReference Include="AnglrParserLibrary" Version="1.0.7" />
<PackageVersion Include="AnglrParserLibrary" Version="1.0.7" />Directory.Packages.props
<PackageReference Include="AnglrParserLibrary" />Project file
paket add AnglrParserLibrary --version 1.0.7
#r "nuget: AnglrParserLibrary, 1.0.7"
#:package AnglrParserLibrary@1.0.7
#addin nuget:?package=AnglrParserLibrary&version=1.0.7Install as a Cake Addin
#tool nuget:?package=AnglrParserLibrary&version=1.0.7Install as a Cake Tool
AnglrMSBuildTasks provides seamless MSBuild integration for the Anglr language compiler, enabling automatic compilation of .anglr grammar files during project builds.
It supports per‑file configuration, incremental builds, and custom output generation.
This package is used by the Anglr compiler, the Anglr VSIX extension, and any .NET project that includes .anglr grammar files.
Anglr language is described on https://www.angstlr.com
.anglr files during dotnet buildAdd the NuGet package:
dotnet add package AnglrMSBuildTasks
Or edit your .csproj:
<ItemGroup>
<PackageReference Include="AnglrMSBuildTasks" Version="x.y.z" />
</ItemGroup>
Or install it directly from VisualStudio:
nuget.org using Search string anglrOnce installed, MSBuild automatically detects .anglr files and compiles them.
AnglrMSBuildTasks defines an MSBuild item type:
<AnglrFile Include="**\*.anglr" />
Each .anglr file is passed to the Anglr MSBuild task, which generates:
.g.cs)You can configure each file individually using metadata.
Each .anglr file supports the following metadata:
| Metadata | Type | Default | Description |
|---|---|---|---|
Debug |
bool | false |
Emit debug information |
Tree |
bool | true |
Generate parse tree |
Loop |
bool | true |
Generate parser loop detection |
Iterator |
bool | false |
Iterative algorithms have an advantage over recursive ones |
Precedence |
bool | false |
Generate precedence grammar |
OutputDir |
string | Syntax |
Name of output directory for generated files |
Code |
string | cs |
Target language (cs - C#, future: java, c++, etc.) |
<ItemGroup>
<AnglrFile Include="Grammar/csharp.anglr">
<Debug>true</Debug>
<Iterator>true</Iterator>
<OutputDir>Generated\Csharp</OutputDir>
</AnglrFile>
</ItemGroup>
<ItemGroup>
<AnglrFile Include="Grammar/math-expression.anglr">
<Precedence>true</Precedence>
</AnglrFile>
<AnglrFile Include="Grammar/very-long-lists.anglr">
<Iterator>true</Iterator>
</AnglrFile>
</ItemGroup>
The Anglr MSBuild task is defined as:
<Anglr
SourceFile="@(AnglrFile)"
Debug="%(AnglrFile.Debug)"
Tree="%(AnglrFile.Tree)"
Loop="%(AnglrFile.Loop)"
Iterator="%(AnglrFile.Iterator)"
Precedence="%(AnglrFile.Precedence)"
OutputDir="%(AnglrFile.OutputDir)"
Code="%(AnglrFile.Code)">
<Output TaskParameter="OutputSourceFileList" ItemName="AnglrGeneratedSource" />
<Output TaskParameter="OutputLibraryFileList" ItemName="AnglrGeneratedLibrary" />
</Anglr>
| Property | type | Required | Description |
|---|---|---|---|
SourceFile |
ITaskItem[] | Yes | The .anglr files to compile |
Debug |
bool | No | Emit debug info |
Tree |
bool | No | Generate parse tree |
Loop |
bool | No | Detect parser loops |
Iterator |
bool | no | Generate iterative syntax tree visitors |
Precedence |
bool | No | Generate precedence grammar |
OutputDir |
string | No | Name of output directory for generated source files |
Code |
string | No | Target language |
| Property | Type | Description |
|---|---|---|
OutputSourceFileList |
ITaskItem[] | Generated source files |
OutputLibraryFileList |
ITaskItem[] | Generated Library files (deprecated) |
Generated files are placed under:
./<OutputDir>
if OutputDir represents relative path. By the contrary, if OutputDir represents absolute path, then generated files are placed under:
<OutputDir>
When the package is installed, we proceed with the following procedure:
For working with .anglr files, it is sufficient to install the AnglrMSBuildTasks package, but for a better experience when working with them, it is recommended to also install the Anglr VSIX extension (AnglrLangExtension from Visual Studio marketplace). You get:
.anglr filesFuture versions will also include:
.anglr file
[ Description Text='definitions of tokens and regular expressions used to define syntax']
[ Description Text='of simple arithmetic expressions']
[
CompilationInfo
ClassName='MathDecls'
NameSpace='Math.Declarations'
Access='public'
]
%declarations mathDecls
%{
%regex
{
decimal-digit [0-9]
number {decimal-digit}+
add \+
sub \-
mul \*
div \/
lb \(
rb \)
}
%terminal
{
NUMBER
add '+'
sub '-'
mul '*'
div '/'
lb '('
rb ')'
}
%}
[ Description Text='definition of scanner, which extracts comments from input string']
[ Declarations Id='mathDecls' ]
[
CompilationInfo
ClassName='CommentRegex'
NameSpace='Math.ScannerLib'
Access='public'
]
%scanner commentScanner
%{
[\*]+\/
pop
[\n\r]
skip
[^\*]+
skip
[\*]+
skip
%}
[ Description Text='definition of scanner, which extracts terminal symbols from input string']
[ Declarations Id='mathDecls' ]
[
CompilationInfo
ClassName='MathRegex'
NameSpace='Math.ScannerLib'
Access='public'
]
%scanner mathScanner
%{
\/\*
push commentScanner
{number}
terminal NUMBER
{add}
terminal add
{sub}
terminal sub
{mul}
terminal mul
{div}
terminal div
{lb}
terminal lb
{rb}
terminal rb
[ \t]+
skip
[\n\r]
skip
.
skip
%}
[ Description Text='Lexer for anglr file' Hover='true' ]
[
UseScanner
ScannerId='commentScanner'
InitialScanner='mathScanner'
Hover='true'
]
[
CompilationInfo
ClassName='MathLexer'
NameSpace='Math.Lexer'
Access='public'
Hover='true'
CodeDir='.'
]
%lexer mathLexer
%{
%}
[ Declarations Id='mathDecls' ]
[ Lexer Id='mathLexer' ]
[
CompilationInfo
ClassName='MathParser'
NameSpace='Math.Parser'
Access='public'
CodeDir='mathParser'
]
%parser mathParser
%{
[ Start ]
expression
: additive-expression
;
additive-expression
: multiplicative-expression
| additive-expression '+' multiplicative-expression
| additive-expression '-' multiplicative-expression
;
multiplicative-expression
: unary-expression
| multiplicative-expression '*' unary-expression
| multiplicative-expression '/' unary-expression
;
unary-expression
: number
| '(' expression ')'
;
number
: NUMBER
| '+' number
| '-' number
;
%}
This file defines the lexical and syntactic analyzer for simple arithmetic expressions: addition, subtraction, multiplication, and division. The syntax is written in such a way that it takes into account the priority of arithmetic operators.
Based on this information, the Anglr compiler generates a set of source C# files, in which the lexical and syntactic analyzer for arithmetic expressions defined in the .anglr file are implemented. In addition to the files in which the lexical and syntax analyzers are implemented, there are also files that can be used to implement the semantic analysis of arithmetic expressions.
These files (C# classes contained within them) can also be used to create applications that calculate simple arithmetic expressions.
With the help of the Anglr compiler, it is also possible to generate lexical and syntactic analyzers for all modern programming languages, such as C#, Java, C++, etc. Working examples for C# and Java can be found on the official website for the Anglr compiler.
In .anglr files, only anglr source code is located. The source code that is used for semantic analysis (written in C#, Java, C++, ..) is written in separate files. Therefore, the syntactic analyzer defined in this way can be used for various purposes, which we implement by adding a new implementation of semantic rules. We can keep the previous one, allowing us to create applications that serve different purposes. Or we can use the same .anglr file to create different applications.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on AnglrParserLibrary:
| Package | Downloads |
|---|---|
|
AnglrMSBuildTasks
AnglrMSBuildTasks provides MSBuild tasks for parsing Anglr source files and generating structured outputs such as parse trees, syntax trees, and intermediate representations. These tasks integrate directly into the build pipeline, enabling automatic parsing, tree construction, code generation, and artifact emission. Supports per-file metadata, incremental builds, and seamless integration with the Anglr toolchain. |
This package is not used by any popular GitHub repositories.