CSLY alternatives and similar packages
Based on the "Parser Library" category
Do you think we are missing an alternative of CSLY or a related project?
C# Lex Yacc
CSLY is highly inspired by the python lex yacc library (PLY) that aims at easen the writing of lexer and parser with C#.
I your too impatient to further read this readme here is a quick getting started that will guide you through the implementation of a dumb parser.
full documentation ##
Complete documentation can be found in the wiki
CSLY special features
CSLY provide some special features that make it easier or safer to use.
CSLY has been thought to avoid any extra build step. Parser generators often need a build time step to generate target language source code that do the parse job. Juste include a nuget and configure your lexer/parser in pure C# code.
CSLY does not need a build time step and easen your build / CI process
compact lexer/parser definition ###
A lexer/parser is defined with only 2 files :
* a C#
enum for the lexer
* a C#
class for the parser
Lexeme and parser production rules are defined with c#
attributes making notation even more compact.
this features already exists with parser combinators (like sprache or Eto.Parse), but productions rules are defined using either BNF or EBNF notation which I think is more natural and easier to understand for maintenance.
Define languages in a very compact and isolated way.
Fully and Strictly typed ###
CSLY is strictly typed, every parser is defines according to its input and output types. For further reading about parser typing, head to [typing section](typing) to correctly type your parser.
Be more confident in parser inputs and outputs validity.
expression parsing ###
Many language needs parsing expressions (boolean or numeric). A recursive descent parser is hard to maintain when parsing expressions with multiple precedence levels. So CSLY offers a way to express expression parsing using only operator tokens and precedence level. CSLY will then generates production rules to parse expressions. It also manages precedence and left or right associativity.
Get rid of the burden of writing an expression parser.
generic lexer ###
Lexemes are often similar from one language to another. So CSLY introduces a Generic Lexer that defines common lexemes that can be reused across languages. furthermore the generic has better performance than a regex based lexer.
Reuse common token definition and take avantage of a better lexer performance.
What is and what is not CSLY
CSLY is not ####
CSLY is not a full featured parser generator like ANTLR. Hence you should not use it to define a full featured language (say C# or Java).
CSLY is ####
CSLY is dedicated to small Domain-Specific Languages that can easily be embedded in a C# code base.
Install from the NuGet gallery GUI or with the Package Manager Console using the following command:
or with dotnet core
dotnet add package sly
*Note that all licence references and agreements mentioned in the CSLY README section above are relevant to that project's source code only.