Re: [h2] How to access the H2 parser and AST?

2020-10-11 Thread Evgenij Ryazanov
Hello. 1. I suggest you not to use any internals of H2 for your own purposes. But if you have no other choice, you need to write an own implementation of org.h2.bnf.BnfVisitor, see org.h2.build.doc.BnfRailroad and org.h2.build.doc.BnfSyntax for examples. 2. BNF of H2 isn't really usable for

Re: [h2] How to access the H2 parser and AST?

2020-10-11 Thread Andreas Reichel
Dear Noel and Team, compliments! I would like to ask for your kind help please. My objective is to write an ANTLR V4. grammar for H2 and of course lazy as I am I would like to use the existing BNF from the CSV and because I am very lazy I do not want to parse that myself, but use the H2 BNF

Re: [h2] How to access the H2 parser and AST?

2020-10-07 Thread Andreas Reichel
On Wed, 2020-10-07 at 15:57 +0200, Noel Grandin wrote: > We use a top-down recursive descent parser, and we have separate > documentation files which we pass through a build-time > tool to generate BNF-type diagrams. This one, right? public static Bnf getInstance(Reader csv) throws

Re: [h2] How to access the H2 parser and AST?

2020-10-07 Thread Noel Grandin
On 2020/10/07 3:54 pm, Andreas Reichel wrote: but please let me ask further: How exactly is the SQL syntax and grammar defined/specified for H2? Is there a BNF file somewhere? Or is it all hard-coded in Java only? We use a top-down recursive descent parser, and we have separate

Re: [h2] How to access the H2 parser and AST?

2020-10-07 Thread Andreas Reichel
Thank you Noel, but please let me ask further: How exactly is the SQL syntax and grammar defined/specified for H2? Is there a BNF file somewhere? Or is it all hard-coded in Java only? I mean, somehow you create your excellent online documentation with the BNF diagrams. Cheers Andreas -- You

Re: [h2] How to access the H2 parser and AST?

2020-10-07 Thread Noel Grandin
On 2020/10/07 2:37 pm, Andreas Reichel wrote: can we access the H2 internal Parse (which should know best) and retrieve the Query AST? I did not find anything in the API documentation. No, the internal parser doesn't generate a real AST, it produces something that roughly half-way

[h2] How to access the H2 parser and AST?

2020-10-07 Thread Andreas Reichel
Dear All, just a quick one: We use JSQLParser as a simple parser in order to get information about a query. Works, but of course it is not perfect. Now I wonder two things: 1. can we access the H2 internal Parse (which should know best) and retrieve the Query AST? I did not