{"id":15039558,"url":"https://github.com/b3b00/csly","last_synced_at":"2026-02-12T22:01:45.119Z","repository":{"id":23105352,"uuid":"89719340","full_name":"b3b00/csly","owner":"b3b00","description":"a C# embeddable lexer and parser generator (.Net core)","archived":false,"fork":false,"pushed_at":"2026-02-12T07:30:42.000Z","size":41332,"stargazers_count":408,"open_issues_count":6,"forks_count":36,"subscribers_count":10,"default_branch":"dev","last_synced_at":"2026-02-12T16:48:54.286Z","etag":null,"topics":["csharp","dot-net","expression-parser","grammar-rules","lexer","lexer-generator","mathematical-parser","parser","parser-generator","recursive-descent-parser"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b3b00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-04-28T15:27:39.000Z","updated_at":"2026-02-12T07:30:47.000Z","dependencies_parsed_at":"2023-10-20T18:03:56.489Z","dependency_job_id":"8219d177-f97c-437d-9881-15fbbf11a327","html_url":"https://github.com/b3b00/csly","commit_stats":{"total_commits":1551,"total_committers":20,"mean_commits":77.55,"dds":"0.44874274661508706","last_synced_commit":"8f0fe3db2e08d40338626618dfa038960f8a4838"},"previous_names":["b3b00/sly"],"tags_count":188,"template":false,"template_full_name":null,"purl":"pkg:github/b3b00/csly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b3b00%2Fcsly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b3b00%2Fcsly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b3b00%2Fcsly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b3b00%2Fcsly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b3b00","download_url":"https://codeload.github.com/b3b00/csly/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b3b00%2Fcsly/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29382862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T20:34:40.886Z","status":"ssl_error","status_checked_at":"2026-02-12T20:23:00.490Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dot-net","expression-parser","grammar-rules","lexer","lexer-generator","mathematical-parser","parser","parser-generator","recursive-descent-parser"],"created_at":"2024-09-24T20:43:17.793Z","updated_at":"2026-02-12T22:01:45.091Z","avatar_url":"https://github.com/b3b00.png","language":"C#","readme":"# C# lex and yacc #      \n\n [![Coverage Status](https://coveralls.io/repos/github/b3b00/csly/badge.svg?branch=dev\u0026kill_cache=1)](https://coveralls.io/github/b3b00/csly?branch=dev)\n[![Build](https://github.com/b3b00/csly/actions/workflows/dotnetcore.yml/badge.svg)](https://github.com/b3b00/csly/actions/workflows/dotnetcore.yml)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fb3b00%2Fcsly.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fb3b00%2Fcsly?ref=badge_shield)\n[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=b3b00_csly)](https://sonarcloud.io/summary/new_code?id=b3b00_csly)\n\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true\u0026ref=dev\u0026repo=89719340)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/b3b00/sly/blob/dev/LICENSE)\n[![NuGet](https://img.shields.io/nuget/v/sly.svg?kill_cache=1)](https://www.nuget.org/packages/sly)\n\n\nCsly is inspired by the Python lex yacc library ([PLY](http://www.dabeaz.com/ply/)) and aims\nto simplify generating lexer/parsers in C#.\n\n## Getting started ##\n\nIf you'd like to get coding right away, read \nthe  [quick getting-started guide](https://github.com/b3b00/csly/wiki/getting-started), which will guide you through the implementation of a basic parser.\n\n## Documentation and examples ## \n\nComplete documentation can be found in the [wiki](https://github.com/b3b00/csly/wiki). For a list of more advanced \nsamples check out the samples folder in the repo.\n\n\n## Csly special features ##\n\nCsly is packed with special features that make it simpler to use, maintainable, and type-safe.\n\n### Fully embeddable ###\n\nCsly has been designed to avoid extra build steps. Parser generators often need a build-time step \n to generate target language source code. That is not the case with csly.\n A simple Nuget command will configure csly for use in a 100% .NET implementation.\n\n\u003e### Csly does not need a build-time step, simplifying the build/CI process\n\n### Compact lexer/parser definition ### \n\nThe csly lexer/parser is defined with only 2 types: \n - a C# ```enum``` for the lexer,\n - a C# ```class``` for the parser.\n\nLexeme and parser production rules are defined using C# custom attributes making your code compact and readable.\nAlthough these features already exist with parser combinators (like [Sprache](https://github.com/sprache/Sprache) \nor [Eto.Parse](https://github.com/picoe/Eto.Parse)), \ncsly can use productions rules defined using either [BNF](https://github.com/b3b00/csly/wiki/BNF-Parser) or [EBNF](https://github.com/b3b00/csly/wiki/EBNF-Parser)  notation, which I think is more natural and easier to understand, assuring maintainability.\n\n\u003e###  Define languages in a very compact and dependency-free way\n\nSee [Lexer](https://github.com/b3b00/csly/wiki/Lexer) for lexers definition and [BNF](https://github.com/b3b00/csly/wiki/BNF-Parser) or  [EBNF](https://github.com/b3b00/csly/wiki/EBNF-Parser) for parser definitions.\n\n### Fully and Strictly typed ### \n\n Csly is strictly typed, so every parser you define renders according to its input and output types. \n For additional details on parser typing, head to the [parser definition section](https://github.com/b3b00/csly/wiki/defining-your-parser).\n\u003e### Be more confident that your parser will generate valid inputs and outputs.\n\n### Expression parsing ### \n\nMany domain-specific languages need parsing expressions (boolean or numeric).\nA recursive-descent parser is hard to maintain when parsing expressions have multiple precedence levels. For that reason, csly offers a way to generate expression-parsing rules using only operator tokens and a simple-to-understand precedence scheme. Csly will then generate production rules to parse expressions, managing precedence and either left-or-right associativity.\n\n\u003e### Avoid burdensome hand-made expression parser implementations.\n\nsee [expression parsing](https://github.com/b3b00/csly/wiki/expression-parsing)\n\n\n### Indentable languages support ###\n\nSome languages use indentation to denote functional blocks, like Python or Yaml.\nCsly provides native support for indentation. Head to [Indented Languages](https://github.com/b3b00/csly/wiki/Indented-languages)\n\n\u003e### Easily use indentation to make your language more readable.\n\n\n### Preserve comments \n\nComments or whitespace are almost every time discardable. But sometimes it makes sens to preserve them : \n\n- use comments to generate auto doc (think javadoc, c#'s xmldoc or python's docstring )\n- introduce meta data without cluttering your grammar\n\nSo CSLY borrowed the (antlr channel concept)[https://datacadamia.com/antlr/channel]. \nEvery lexeme can be redirected to a specific channel. By default comments go to channel 2.\n\nThis feature is already available on branch dev but not deployed in any nuget package.\nDocumentation is also a work in progress event though you can have it a glance looking at (EBNF unit tests)[https://github.com/b3b00/csly/blob/dev/ParserTests/EBNFTests.cs] :\n  - [TestIndentedParserNestedBlocks](https://github.com/b3b00/csly/blob/dev/ParserTests/EBNFTests.cs#L1357)\n  - [TestIndentedParserWithEolAwareness](https://github.com/b3b00/csly/blob/dev/ParserTests/EBNFTests.cs#L1409)\n  - [TestIndentedParserWithEolAwareness2](https://github.com/b3b00/csly/blob/dev/ParserTests/EBNFTests.cs#L1445)\n  - [TestIssue213WithChannels](https://github.com/b3b00/csly/blob/dev/ParserTests/EBNFTests.cs#L1481)\n    \n\n\n### Generic lexer ### \n\nLexemes are often similar from one language to another. Csly introduces a generic lexer that defines common lexemes and which can be reused across languages. \nThe built-in generic lexer has better performance than a regex-based lexer.\n\n\u003e### Reuse common token definition and take advantage of better lexer performance.\n\nSee [Generic lexer](https://github.com/b3b00/csly/wiki/GenericLexer) for the generic lexer implementation and [Lexer](https://github.com/b3b00/wiki/Lexer) for a general presentation on rolling your own.\n\n\n### What Csly is and isn't ###\n\n#### Csly is not #### \n\nCsly is not a fully-featured parser generator like [ANTLR](http://www.antlr.org/).\nYou should therefore not use it to define strong-typed languages like  C# or Java.\n\n#### Csly is #### \n\nCsly is perfect for small [domain-specific languages (DSLs)](https://en.wikipedia.org/wiki/Domain-specific_language) that can be bundled in C# applications for end-users to interact with your application using natural language, for example. \n\n## Installation ##\n\nInstall from the NuGet gallery GUI or with the Package Manager Console using the following command:\n\n```Install-Package sly```\n\nor with dotnet core \n\n```dotnet add package sly```\n\n# Buy me a coffee\n\nIf you found CSLY usefull consider supporting with : \n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/b3b00)\n\n# Special thanks to\n\n\u003ca href=\"https://jb.gg/OpenSource\"\u003e\u003cimg height=\"200\" src=\"src/logos/jetbrains-variant-2.svg\"\u003e\u003ca\u003e\n","funding_links":["https://www.buymeacoffee.com/b3b00"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb3b00%2Fcsly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb3b00%2Fcsly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb3b00%2Fcsly/lists"}