I know we are sponsoring This... But it sounds to me like so much work and so 
little gain. Sure, the current parse thing is slow and buggy, but only a few 
minor bugs and performance gain Will be limited as well. I think looking at 3th 
party parsers isn,'t a bad idea at All.

Sent from my Windows Phone
________________________________
From: Jiří Činčura<mailto:j...@cincura.net>
Sent: ‎6/‎10/‎2015 6:38
To: For users and developers of the Firebird .NET 
providers<mailto:firebird-net-provider@lists.sourceforge.net>
Subject: Re: [Firebird-net-provider] Parser class/library

On Mon, Oct 5, 2015, at 21:32, Michał Ziemski wrote:
> IMHO you won't be able to handle all the corner cases without full
> grammar
> parser.

Well, the cases we need are not that wide. But it's tedious anyway.

> For example consider a "SET TERM" inside an "EXECUTE BLOCK".
> Lacking the grammar understnding you won't recognize that as an invalid
> term in the execute block and
> you'll simply cut the block in half. So the decision is how far do you

I don't care much about invalid scripts. It fails either way. But I
agree that it's at least confusing for people consuming the library.

> want
> to go.

Personally, not far. :) There's way more interesting pieces.

> Writing a full scale parser for FB SQL in a rather easy but very tedious
> and time-consuming task.
> Having that as a tool would be a great addition to FB ecosystem.
> The parser in FB itself is written in yacc so it's faily transportable.
> Sill you'll have to go rule by rule
> and convert to C#.
> Actually I have tried this myself in F# (it's far far better suited for
> parsers) and am about 50% through.
> I would gladly donate the code if you'd be interested.

I don't think it will hurt.

> If you would preffer the faster approach I would suggest:
>  - a simple lexer by hand that recognizes tokens "SET" "TERM"
> CURRENT_TERM_SYMBOL "--" , NEWLINE OTHER_TOKEN and STRING
>  - a parser that iterates the tokens form lexer, tests for sequences:
> "SET" "TERM" OTHER_TOKEN CURRENT_TERM_SYMBOL - to set new terms
> CURRENT_TERM_SYMBOL - to yield accumulated OTHER_TOKENs and STRINGs
> -  -- to start a comment and skip everything till NEWLINE
> this should be an easy enough state machine to write by hand.

That's what I'm currently doing. Sadly.

--
Mgr. Jiří Činčura
Independent IT Specialist

------------------------------------------------------------------------------
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
------------------------------------------------------------------------------
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to