Skip to content
Olivier Duhart edited this page Nov 4, 2022 · 13 revisions

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.

Why?

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.

General principle

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.

How to use csly

Csly is a composite library containing:

Installation

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

CSLY CLI companion tool

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