Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Req] PL/SQL Parser #31

Open
tsutomi opened this issue Nov 25, 2015 · 2 comments
Open

[Req] PL/SQL Parser #31

tsutomi opened this issue Nov 25, 2015 · 2 comments

Comments

@tsutomi
Copy link

tsutomi commented Nov 25, 2015

Hi! I'm developing a .NET SQL-99 database system ( http://github.com/deveel/deveeldb ): in the old version (pre-2.0) I used a CC that I ported from Java (JavaCC to CSharpCC), that was performing quite well, but with a lot of problems with the maintainance and extendibility.
Because of these issues, I decided to switch to Irony, that was quite a discovery, letting me define the grammar of the SQL parser directly in-code and with huge control on the analysis of the sources.

A guy interested in my project pointed me to Eto.Parse, especially highlighting the performances gain, and based on your reports this is justified.
So now I'm very interested in understanding more about it, although I see an evident learning curve not easy to overcome.

Could you provide a sample of a complete PL/SQL parser that I can use as reference?

@tsutomi
Copy link
Author

tsutomi commented Nov 25, 2015

I tried creating a SQL-2003 parser using an EBNF grammar (attached): the parser build takes seconds and the match hangs forever:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Eto.Parse.Grammars;

namespace Eto.Parse.SqlTest {
    class Program {
        static void Main(string[] args) {
            var sqlFile = Path.Combine(Environment.CurrentDirectory, "sql-2003-2.txt");
            string fileContent;
            using (var reader = File.OpenText(sqlFile)) {
                fileContent = reader.ReadToEnd();
            }

            var grammar = new BnfGrammar();
            var parser = grammar.Build(fileContent, "SQL procedure statement");

            var match = parser.Match("SELECT * FROM table1 AS a INNER JOIN table2 AS B ON a.id = b.a_id WHERE a.name = 'test'");
            if (match.Empty) {
                Console.Out.WriteLine("Empty match");
            }
        }
    }
}

sql-2003-2.txt

ArsenShnurkov pushed a commit to ArsenShnurkov/SqlParser-on-EtoParse that referenced this issue Dec 15, 2015
@ArsenShnurkov
Copy link

rule is not defined

I parsed your test SELECT statement - https://github.com/ArsenShnurkov/SqlParser-on-EtoParse/blob/9c4e2edadf0756760c6c40878c06441292af253a/test1/Globals.cs

start - Tue Dec 15 22:20:04
stop - Wed Dec 16 01:52:51
debug time < 4h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants