Farkle is a text parser library for .NET, featuring the best of both worlds: LALR parser combinators. Users define the terminals and nonterminals of their grammars, what to do when each of them is encountered, and Farkle takes care of the rest.
It can be installed from NuGet.
- Speed: Farkle is fast. Its performance is a top priority and lots of time has been invested in its optimization.
- Language compatibility: Farkle is usable from both C# and F#, with an intuitive API for each language. It even supports C# 8.0's nullable reference types!
- Fast development cycle: Unlike parser generators, Farkle does not generate any source files. Your grammars are type-safe and created entirely from code, allowing features like IntelliSense and real-time syntax error reporting.
- Integration with MSBuild: Farkle can optionally integrate with MSBuild to enable features like ahead-of-time grammar building which drastically reduces startup times and catches grammar errors like LALR conflicts at compile time.
- Large file support: Farkle can parse large files without entirely reading them to memory.
- Grammar introspection: Farkle provides APIs that allow your grammars to be inspected from code.
- Wide framework support: Farkle targets .NET Standard 2.0, supporting .NET Framework 4.6.1+, .NET Core 2.0+, Xamarin, UWP and Unity.
Learn more about Farkle's features, compared with other .NET parsers.
The library comes with comprehensible documentation.
Quick Start: Creating a calculator to get started with writing a simple calculator in F#.
Using Farkle with C# to learn what changes when using Farkle in a C# project.
API Reference contains automatically generated documentation for all types, modules and functions in the library.
A mathematical expression parser powered by Farkle and written in F#, also showcasing some more advanced features.
A simple indent-based language parser that supports virtual terminals written in F#. The most advanced example; it explains how to write a custom tokenizer.
The library is available under the MIT license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.