EBNFMaxing 0.2.0

dotnet add package EBNFMaxing --version 0.2.0
                    
NuGet\Install-Package EBNFMaxing -Version 0.2.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="EBNFMaxing" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EBNFMaxing" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="EBNFMaxing" />
                    
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 EBNFMaxing --version 0.2.0
                    
#r "nuget: EBNFMaxing, 0.2.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 EBNFMaxing@0.2.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=EBNFMaxing&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=EBNFMaxing&version=0.2.0
                    
Install as a Cake Tool

<p align="center"> <img src="resources/images/longlogo.svg" alt="EBNFMaxing" width="400"> </p>

EBNFMaxing

Generate sentences from grammar rules and input tokens.

EBNFMaxing is a .NET library that turns an EBNF grammar and a stream of tokens into output text. Define your grammar, feed it data (string, JSON, or tokens), and get a generated result.


What is it?

Imagine you have a template for how sentences should be built — optional parts, repeated sections, choices between alternatives. EBNFMaxing lets you express that template as a grammar and then run it against real data.

You write rules. You provide input. You get output.

  • Grammar — EBNF-like rules: optional blocks [...], choices (...|...), loops {...}, and semantic actions that consume tokens and stack values
  • Input — A string (each char → token), a JSON object, or a stack of key/value tokens
  • Output — A string, JSON, or a deserialized object via Produce<T>

It’s a general-purpose sentence generator: useful for templating, DSL output, code generation, or any scenario where structure is driven by grammar rules.


Quick start

using Grammars;
using Grammars.Extensions;

var grammar = new GrammarEbnf();
grammar.AddProduction("A = (<a> | <b>)(<a> | <b>)(<a> | <\"c>)");

var result = grammar.ProduceString("ab");
// result == "abc"

Three lines: create the grammar, add a production, produce. That’s it.


Installation

dotnet add package EBNFMaxing

Or in your .csproj:

<PackageReference Include="EBNFMaxing" Version="0.2.0" />

A taste of the syntax

Concept Syntax What it does
Consume a token <key> Matches token by key, stacks its value
Static literal <"value"> Stacks a fixed string (no token consumed)
Optional block [content] Runs 0 or 1 time if the first action matches
Choice (a \| b \| c) Picks the first branch that matches
Loop {content} Repeats while the first action matches
Call production :Name: Invokes another production

For the full picture, see the Wiki.


Example

Grammar: A = <x>[<"-"><y>]x plus an optional -y part

Input: {"x":"foo","y":"bar"}Output: "foo-bar"
Input: {"x":"foo"}Output: "foo"


Learn more

  • Wiki — Getting started, grammars, primitives, productions, examples
  • Roadmap — Planned features
  • Changelog — Version history
  • License — MIT
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
0.2.0 146 3/13/2026
0.1.3 187 2/28/2026