Coder Social home page Coder Social logo

xoofx / antlr4ast Goto Github PK

View Code? Open in Web Editor NEW
50.0 3.0 2.0 980 KB

Antlr4Ast is a .NET library that provides a parser and abstract syntax tree (AST) for ANTLR4/g4 files.

License: BSD 2-Clause "Simplified" License

C# 85.45% ANTLR 14.55%
abstract-syntax-tree antlr antlr4 ast csharp dotnet parser

antlr4ast's People

Contributors

ghost4man avatar xoofx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

antlr4ast's Issues

Add a Visitor pattern

The library does not contain a visitor pattern.

I don't have a personal usage for this as I'm only going to go through the lexer/parser rules manually for my use case, but if there is an interest, PR welcome.

Rename a few classes for 2.0

There are a few classes that are not named correctly and should be changed in the next major version:

  • LexerChar should be LexerCharSet

(Temporary list for now, might change in the near future)

Greedy SuffixKinds are actually nongreedy

As described in the ANTLR4 documentation, (...)??, (...)*? and (...)+? are nongreedy (lazy) subrules.

But the SuffixKind enum in Antlr4Ast names these suffixes as Greedy (which is the opposite of what they are):

/// <summary>
/// The star `*?` suffix represents 0 or more elements with a greedy matching.
/// </summary>
StarGreedy,
/// <summary>
/// The plus `+?` suffix represents 1 or more elements with a greedy matching.
/// </summary>
PlusGreedy,
/// <summary>
/// The question `??` suffix represents 0 or 1 element with a greedy matching.
/// </summary>
OptionalGreedy,

Simply renaming the enum members would break backwards (source) compatibility, so I would suggest keeping the original names with the same value at the bottom (so that ToString prints the correct name), but with an [Obsolete("...")] attribute (and potentially an [EditorBrowsable(EditorBrowsableState.Never)] attribute to hide them from IntelliSense).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.