Skip to content

furesoft/Silverfly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silverfly

CodeFactor NuGet Version NuGet Downloads License: GPL v3 Discord Libraries.io SourceRank

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:

dotnet add package Silverfly

Usage

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 evaluated = parsed.Tree.Accept(new EvaluationVisitor());

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

For more detailed instructions and advanced usage, please refer to the Wiki. A great example can be found here

Silverfly uses the brilliant library from MrKWatkins to build an AST.

Contributing

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