GithubHelp home page GithubHelp logo

daxnet / irony Goto Github PK

View Code? Open in Web Editor NEW
154.0 15.0 47.0 389 KB

A modified version of the Irony project (https://irony.codeplex.com) with .NET Core support

License: MIT License

C# 99.89% PowerShell 0.11%
parser-generator

irony's Introduction

Hi there ๐Ÿ‘‹

I used to be a Microsoft Most Valuable Professional (MVP) from the year 2012 to 2019, mostly focused on Development Technologies. Now I am currently working for PerkinElmer Informatics R&D as a Principal Software Engineer.

I am a fan of Microsoft development technologies, specifically, .NET (C#). I am also interested in software architecture, OOAD, DDD, big data, AI and agile development methodologies.

irony's People

Contributors

daxnet avatar igitur avatar jburman avatar nikkelmann avatar sebastienros 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  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  avatar  avatar

Watchers

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

irony's Issues

No documentation is existant and unable to run the code with dotnet core 2.2

Where could I find Irony .NET framework (or preferably dotnet core) documentation? Codeplex site states that This project migrated to https://github.com/IronyProject/, however I could not find any documentation on both github and codeplex sites (it seems outdated and non-buildable for current versions of .NET framework). On the other hand, the A modified version of the Irony project (https://irony.codeplex.com) with .NET Core support doesn't provide any documentation at all. There is just an example that doesn't seem to run. Also, some examples of languages seem to be incorrect as they fail build.

Is the framework still maintained or it got obsolete and it is revival state. Seems quite difficult to learn anything about it from the examples (although the examples are quite similar to the BNF).

Are there any substitutions?

** Got redirected from stackoverflow.com **

Irony -DotNetcore- Missing features

I could see these features DynamicCallDispatcher,EvaluationContext,datastack,StackFrame,Valuetable are currently not available in Irony DotNetcore source code.Could you please let me know why it has removed and do we have any alternative for this.

Compilation error

I am getting a compile error on this line:
using Irony.Interpreter.Ast;

"The type or namespace name 'Interpreter' does not exist in the namespace 'Irony' (are you missing an assembly reference?)"

I am using .Net 6

NumberLiteral uses CurrentCulture.CurrentCulture

I'd like to understand when the behavior changed, looking at codeplex https://irony.codeplex.com/SourceControl/latest#Irony/Parsing/Terminals/NumberLiteral.cs it's using CultureInfo.InvariantCulture but in this repository it's CultureInfo.CurrentCulture.

The difference is that parsing a number like 123.45 on a French system for instance will fail as it's not using . as the decimal separator. Using InvariantCulture provides a consistent result at least, forcing ..

Is that something that was introduced in the repository only? Or should we then change it to InvariantCulture?
Is there a more recent official repository other than the codeplex one?

Help understanding syntax error with non-terminal, ok with terminal

Here's a complete repro if the issue I'm trying to resolve. The output will be:
Error:Syntax error, expected: > ((1:10))

If all you do is comment out the line marked fails and uncomment the line marked succeeds, the expression parses successfully.

There's an ambuguity with "<" in that it might be part of an 'infix' expression or the beginning of a part of a 'componentAccess' expression, but I expected Irony to work it out since the componentAccess rule won't be met, whereas infix is. It seems to be able to do that when the infixOp is removed as a non-terminal and a pure terminal used instead.

Either this indicative of a bug or I just need help understanding this behavior, and whether or not its possible to have a grammar parsed successfully this way. I've played with grammar hints to no avail. This is a simplified version of the actual grammar I'm using, for demonstration purposes.

    class Program
    {
        static void Main(string[] args)
        {
            Try("abc < xyz");

            Console.ReadLine();
        }

        private static void Try(string expr)
        {
            var p = new Parser(new ExpressionGrammar());
            var result = p.Parse(expr);
            Console.WriteLine(result.Status + ":" + string.Join("\n", result.ParserMessages.Select(m => $"{m.Message} ({m.Location})")));
        }

        public class ExpressionGrammar : Grammar
        {
            public ExpressionGrammar() : base(false)
            {
                var formula = new NonTerminal("formula");
                var infix = new NonTerminal("infix");
                var infixOp = new NonTerminal("infixOp");
                var componentAccess = new NonTerminal("componentaccess");
                var identifier = new NonTerminal("identifier");

                Root = formula;

                formula.Rule =
                    identifier
                    | componentAccess
                    | infix
                    ;

                identifier.Rule = ToTerm("abc") | ToTerm("xyz");
                infixOp.Rule = ToTerm("<");
                // e.g.: abc<xyz>.abc
                componentAccess.Rule = formula + "<" + identifier + ">" + "." + identifier;

                // fails
                infix.Rule = formula + infixOp + formula;
                // succeeds (inlining infixOp)
                //infix.Rule = formula + ToTerm("<") + formula;
            }
        }
    }

Apply the StringSegment treatment

From the benchmarks I have done for the library where I am using Irony, I can say that it's allocating a lot of memory. I think that modifying the code base to use StringSegment would improve things a lot.

It might not be an easy change but would probably improve the overall performance. I might try to do it when I find the time.

Nuget

Please push a build to Nuget. That will enable other libraries to use it too. The Myget feed works, but it's really complicated for users of my libraries that depend on this.

Sample app evaluates to 35 instead of 12.5 when culture info uses comma as decimal separator

When running the sample with the InvariantCulture the output is 12.5, which is mathematically correct.

If the culture info is changed to "da-DK" or "de-DE" the output is 35.
The expression ends up as "25 Add 3 Sub 1 Mul 5" and not "2.5 Add 3 Sub 1 Mul 5".

Since it works with "en-GB" and "en-US" my guess is that the decimal or thousand separator is the culprit.

Bonus: Changing the culture to "sv-SE" (Swedish) throws a FormatException on "var value = Convert.ToSingle(node.Token.Text);".

Unable to open any of the .csproj files

The project files don't appear to be supported on my installation of VS 2015, when I open the solution I get:

<local-install>\irony\src\Irony\Irony.csproj : error  : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.  <local-install>\irony\src\Irony\Irony.csproj

<local-install>\irony\src\Irony.Interpreter\Irony.Interpreter.csproj : error  : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.  <local-install>\irony\src\Irony.Interpreter\Irony.Interpreter.csproj

<local-install>\irony\src\Irony.SampleApp\Irony.SampleApp.csproj : error  : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.  <local-install>\irony\src\Irony.SampleApp\Irony.SampleApp.csproj

<local-install>\Desktop\irony\src\Irony.Tests\Irony.Tests.csproj : error  : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.  <local-install>\Desktop\irony\src\Irony.Tests\Irony.Tests.csproj

It appears to have a similar problem on Xamarin Studio.

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.