Quang 2.1.0

dotnet add package Quang --version 2.1.0
                    
NuGet\Install-Package Quang -Version 2.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Quang" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Quang" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Quang" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Quang --version 2.1.0
                    
#r "nuget: Quang, 2.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Quang@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Quang&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Quang&version=2.1.0
                    
Install as a Cake Tool

Quang

Quang is meant to be a "query" language for your tools.

Quang extends for Query Language.

You can use the language to implement filters in your applications without the need of tons of flags to your user, just provide a simple and consise integrated language and let the user build the filter himself.

So, it is at the end a "language as a lib".

There is a full playlist on youtube creating this project.

Api and language details

Does not matter what kind of query you provide as input to the evaluator, it will always return true or false. If the query is empty, it will always return true.

Data Types

name supported format description
Integers yes [0-9]+ golang 64bit signed integers
Atoms yes :[a-zA-Z_]+ it works like enumerators
String yes '.*' you can scape string with \'
Boolean yes true\|false
Nil yes nil represents all kinds of empty values ("", nil) (zero is not considered empty)
Floats yes \d+\.\d* golang 64bit floats

Keywords

name description usage
not negation not false
and logical and true and true
or logical or true or false
nil null value name eq nil
true boolean true alive eq true
false boolean false alive eq false

Operators

name description example
not negate boolean expressions not (status eq 400)
eq check if a is equal to b. strict types. (Integers, Strings, Booleans, Nils, Floats, Atoms) a eq b
ne check if a is not equal to b. strict types. (Integers, Strings, Booleans, Nils, Floats, Atoms) a ne b
lt check if a is less than b. strict types. (Integers, Strings) a lt b
gt check if a is greater than b. strict types. (Integers, Strings) a gt b
lte check if a is less than or equal to b. strict types. (Integers, Strings) a lte b
gte check if a is greater than or equal to b. strict types. (Integers, Strings) a gte b
reg check if a matches pattern b. b accepts valid regex. a should be a string a reg b

Basic syntax

Pretend we have a list of computers that have the following properties:

  • Identifier
  • Running
  • Cors

So, we could query something like:

(running eq true and cors gte 4 and cors lte 10) or (running eq false and identifier reg 'ML-\d+') or identifier eq nil

This repository is a port of Quang for CSharp. See the original repository for more information.

How to Use

Let's pretend you have a list of people and you need to build a CLI to search this list.

username,age,sex,weight
user001,25,M,70.2
user002,31,F,60.7
user003,22,M,68.4
user004,29,F,55.9
user005,35,M,80.1
user006,28,F,62.5
user007,24,M,72.3
user008,30,F,59.6
user009,27,M,75.8
user010,33,F,65.2
user011,26,M,71.4
user012,32,F,63.7
user013,23,M,69.9
user014,34,F,58.3

Then, you can with a less than 20 lines of code integrate the language with your cli.

Here is a fully function example:

using Quang;

if (args.Length != 1)
{
    Console.WriteLine("Usage: dotnet run -- <search-query>");

    return;
}

string[][] content = [.. File.ReadAllLines("./logs.txt")[1..].Select(line => line.Split(','))];

var quang = new Quang.Quang(args[0])
    .Init()
    .SyntaxExpectAtom(":f")
    .SyntaxExpectAtom(":m")
    .SyntaxExpectSymbol("age", new ExpressionValueTypeInfo<IntegerExpression>())
    .SyntaxExpectSymbol("weight", new ExpressionValueTypeInfo<FloatExpression>())
    .SyntaxExpectSymbol("username", new ExpressionValueTypeInfo<StringExpression>())
    .SyntaxExpectSymbol("sex", new ExpressionValueTypeInfo<AtomExpression>());

foreach (var line in content)
{
    var username = line[0].Trim();
    var age = int.Parse(line[1]);
    var sex = line[2].ToLower().Trim();
    var weight = float.Parse(line[3]);

    var evaluator = quang.Evaluator()
        .AddStringVar("username", username)
        .AddAtomVar("sex", $":{sex}")
        .AddIntegerVar("age", age)
        .AddFloatVar("weight", weight);

    if (evaluator.Evaluate())
        Console.WriteLine($"Matched: {username},{age},{sex},{weight}");
}

In fact, this example is present here.

Then, if you run and use this filter: dotnet run -- 'sex eq :m and weight lte 70.0 and age gte 23', it should return you this:

Matched: user013,23,m,69.9

✨ Is that easy!

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 115 5/15/2026
2.0.0 146 4/5/2026
1.0.0 106 4/3/2026