An embeddable lexer and parser generator for C#/.NET, inspired by PLY, for building domain-specific languages.
Csly is a C# lexer and parser generator inspired by Python's PLY library, designed to create parsers for domain-specific languages (DSLs) within .NET applications. It allows developers to define lexers and parsers using C# enums, classes, and custom attributes without requiring external build steps, making it fully embeddable. The tool supports BNF and EBNF notation, strict typing, expression parsing, and indentation-based languages.
C#/.NET developers building domain-specific languages, configuration parsers, or natural language interfaces within their applications, especially those who prefer an embeddable, no-build-step solution.
Developers choose Csly for its simplicity and embeddability—it eliminates complex build processes by integrating directly via NuGet, offers a compact attribute-based definition style, and provides features like expression parsing and indentation support out of the box, making it ideal for small to medium DSLs.
a C# embeddable lexer and parser generator (.Net core)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Eliminates external build steps by integrating via NuGet, enabling a pure .NET workflow and simplifying CI processes as highlighted in the README.
Uses C# enums and classes with custom attributes for lexer and parser definitions, keeping code readable and dependency-free, as demonstrated in the BNF/EBNF notation support.
Automatically generates expression rules with precedence and associativity management, reducing manual effort for DSLs with mathematical or logical operators.
Provides native handling for indentation-based languages like Python, making it straightforward to implement block structures without custom logic.
The README explicitly states it's not for full-featured languages like C# or Java, restricting its use to small DSLs and lacking advanced parsing features found in tools like ANTLR.
Some features, such as comment preservation via channels, are still in development on the dev branch and not yet available in stable NuGet releases, indicating slower updates.
Compared to established parser generators, Csly has a smaller community and fewer pre-built grammars, which can increase development time for niche or complex DSL requirements.
CSLY is an open-source alternative to the following products: