An open API service indexing awesome lists of open source software.

https://github.com/furesoft/Silverfly

Build parsers easily
https://github.com/furesoft/Silverfly

dsl dsl-syntax help-wanted parser parser-library parsing pratt pratt-parser pratt-parsing syntax syntax-tree

Last synced: about 2 months ago
JSON representation

Build parsers easily

Awesome Lists containing this project

README

          

# Silverfly

[![CodeFactor](https://www.codefactor.io/repository/github/furesoft/silverfly/badge)](https://www.codefactor.io/repository/github/furesoft/silverfly)
![NuGet Version](https://img.shields.io/nuget/v/silverfly)
![NuGet Downloads](https://img.shields.io/nuget/dt/Silverfly)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Discord](https://img.shields.io/discord/455738571186241536)
![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/nuget/silverfly)
[![](https://tokei.rs/b1/github/furesoft/Silverfly)](https://github.com/furesoft/Silverfly)

Silverfly is a versatile parsing framework that provides extensive support for building custom parsers with ease. It
supports Pratt parsing, a powerful method for parsing expressions and statements in a flexible manner.

## Features

- **Flexible Parsing**: Supports Pratt parsing for complex expression handling.
- **Extensible**: Easily extend the parser and lexer with custom rules.
- **Documentation**: Comprehensive instructions available in the wiki.

## Installation

To install Silverfly, you can use NuGet:

```bash
dotnet add package Silverfly
```

## Usage

```csharp
using Silverfly;

namespace Sample;

public class Program
{
public static void Main(string[] args)
{
while (true)
{
Console.Write("> ");
var input = Console.ReadLine();

var parsed = new ExpressionGrammar().Parse(input);
var context = new EvaluationContext();
EvaluationListener.Listener.Listen(context, parsed.Tree);

Console.WriteLine("> " + evaluated);
}
}
}
```

For more detailed instructions and advanced usage, please refer to
the [wiki](https://furesoft.gitbook.io/silverfly).
A great example can be found [here](https://github.com/furesoft/Silverfly/blob/main/Source/Samples/Sample.FuncLanguage/ExpressionGrammar.cs)

Silverfly uses the brilliant library from [MrKWatkins](https://github.com/MrKWatkins/Ast/) to build an AST.

## Contributing

We welcome contributions! Please see our contributing guidelines for more details on how to get involved.