-
Notifications
You must be signed in to change notification settings - Fork 35
Home
Welcome to the csly wiki! Csly is a parser generator implementing some features of parser combinators-generators like lex and yacc, also known from their GNU implementations, Flex and Bison.
I needed a solution for building parsers and found all existing solutions either
- too complicated to integrate with an additional build step, such as ANTLR,
- too different from the classical Backus–Naur form (BNF) notation used in parser combinators like sprache or Eto.Parse.
These tools are great, but I don't feel comfortable with them. More on this at How does csly compare to other options.
Csly is highly inspired by the Python lex yacc library (PLY). The parser and lexer implementations can be invoked from just two C# types:
- a C#
enum
that describes every token, - a C#
class
containing every grammar rule and its associated action to transform the syntaxic tree.
Csly is a composite library containing:
- a lexer component which makes it easy to write a lexer/scanner,
- a parser component which can be used to write parsers with BNF or EBNF notation,
- an expression parsing component.
Install from the NuGet gallery GUI or with the Package Manager Console using the following command:
Install-Package sly
or with dotnet core
dotnet add package sly
The CSLY CLI companion tool allow to quickly test and debug formal grammar for CSLY. Its documentation is still a work in progress.
Home ➡️ Getting started