All Projects → b3b00 → Csly

b3b00 / Csly

Licence: mit
a C# embeddable lexer and parser generator (.Net core)

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Csly

Tiny Compiler
A tiny compiler for a language featuring LL(2) with Lexer, Parser, ASM-like codegen and VM. Complex enough to give you a flavour of how the "real" thing works whilst not being a mere toy example
Stars: ✭ 425 (+229.46%)
Mutual labels:  lexer, parser
Php Zephir Parser
The Zephir Parser delivered as a C extension for the PHP language.
Stars: ✭ 129 (+0%)
Mutual labels:  parser-generator, parser
Minigo
minigo🐥is a small Go compiler made from scratch. It can compile itself.
Stars: ✭ 456 (+253.49%)
Mutual labels:  lexer, parser
Intellij Plugin V4
An IntelliJ plugin for ANTLR v4
Stars: ✭ 318 (+146.51%)
Mutual labels:  parser-generator, parser
Rs Monkey Lang
Monkey Programming Language written in Rust.
Stars: ✭ 80 (-37.98%)
Mutual labels:  lexer, parser
Verible
Verible is a suite of SystemVerilog developer tools, including a parser, style-linter, and formatter.
Stars: ✭ 384 (+197.67%)
Mutual labels:  lexer, parser
Mico
Mico ("Monkey" in catalan). Monkey language implementation done with C++. https://interpreterbook.com/
Stars: ✭ 19 (-85.27%)
Mutual labels:  lexer, parser
Diagon
Interactive ASCII art diagram generators. 🌟
Stars: ✭ 189 (+46.51%)
Mutual labels:  lexer, parser
Charly Vm
Fibers, Closures, C-Module System | NaN-boxing, bytecode-VM written in C++
Stars: ✭ 66 (-48.84%)
Mutual labels:  lexer, parser
Csstree
A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations
Stars: ✭ 1,121 (+768.99%)
Mutual labels:  lexer, parser
Syntax Parser
Light and fast 🚀parser! With zero dependents. - Sql Parser Demo added!
Stars: ✭ 317 (+145.74%)
Mutual labels:  lexer, parser
Nodable
a node-able bidirectionnal expression editor.
Stars: ✭ 103 (-20.16%)
Mutual labels:  lexer, parser
Exprtk
C++ Mathematical Expression Parsing And Evaluation Library
Stars: ✭ 301 (+133.33%)
Mutual labels:  lexer, parser
Php Parser
🌿 NodeJS PHP Parser - extract AST or tokens (PHP5 and PHP7)
Stars: ✭ 400 (+210.08%)
Mutual labels:  lexer, parser
Cub
The Cub Programming Language
Stars: ✭ 198 (+53.49%)
Mutual labels:  lexer, parser
Pigeon
Command pigeon generates parsers in Go from a PEG grammar.
Stars: ✭ 603 (+367.44%)
Mutual labels:  parser-generator, parser
Participle
A parser library for Go
Stars: ✭ 2,302 (+1684.5%)
Mutual labels:  lexer, parser
Snapdragon
snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory.
Stars: ✭ 180 (+39.53%)
Mutual labels:  lexer, parser
Logos
Create ridiculously fast Lexers
Stars: ✭ 1,001 (+675.97%)
Mutual labels:  lexer, parser
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (-25.58%)
Mutual labels:  lexer, parser

C# Lex Yacc

Test status coveralls .NET Core FOSSA Status

License: MIT NuGet

CSLY is highly inspired by the python lex yacc library (PLY) and aims at easen the writing of lexer and parser with C#.

Getting started

If you're 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.

fully embedded

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.

See Lexer for lexers definition. And BNF or EBNF for parser definitions.

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 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.

see expression parsing

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.

See Generic lexer for generic lexer and Lexer for general presentation.

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.

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

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].