[hibernate-dev] Query handling : Antlr 3 versus Antlr 4

Steve Ebersole steve at hibernate.org
Sun Jun 21 15:26:39 EDT 2015


I have committed a lot of work on this PoC to my upstream repo.

The initial walk to process the explicit from-clause is pretty much done.
Overall I really like the shape of FromClause, FromElementSpace and
FromElement.  One question of structure here I have not decided yet is the
relationship of joins.  At the moment I simply collect all joins for a
FromElementSpace
in a single List.  So FromElementSpace has a root FromElement and then a
list of JoinedFromElements.  The other option is to link up joins under
their corresponding "left hand side".  This second option is harder, and I
am not sure what we gain specifically.

The FromClauses, etc ultimately become part of the semantic query
representation.  The semantic tree is shaped by a second walk over the
parse tree.  This part is still a work in progress, although it is pretty
far along.  The current semantic tree is a first (rough)  cut.  Ultimately
I'd like to move the shape of the semantic tree more in the direction of
the JPA criteria contracts.  Specifically, the parts I am missing right now
is the concept of a Path.  A Path would help unify/centralize some of the
things from Expression and FromElement.

I will need to refocus back on 5.0 for the next week or so.  Once CR2 is
done I will come back to this work, but soon we will need to have a
discussion/vote about the use of Antlr v3 versus v4 and, if we go with v4,
the specific approach.  Also we need to prioritize this against the other
roadmap items.  To me the 2 highest priorities need to be this work and the
Jandex/general-annotation-binding-redesign work.  But we will need to rank
them all.



On Wed, Jun 17, 2015 at 7:47 AM Gunnar Morling <gunnar at hibernate.org> wrote:

> This seems very similar to what I had in mind with the decorator stuff.
> The decorating elements would represent that manually implemented semantic
> tree.
>
> In the end it probably doesn't even matter whether the elements of that
> tree would have links to the parse tree elements they originated from or
> whether that tree is completely "stand-alone". As you say, we'd
> traverse/alter it with our own listeners. In my understanding that's as
> good as it gets with Antlr4.
>
>
>
> 2015-06-16 23:04 GMT+02:00 Steve Ebersole <steve at hibernate.org>:
>
>> I am not so sure that manually building a tree that would work with
>> listeners/visitors generated from a second grammar is going to be an
>> option.  I have asked on SO and on the Antlr discussion group and
>> basically
>> got no responses as to how that might be possible.  See
>> https://groups.google.com/forum/#!topic/antlr-discussion/vBkwCovqHcI
>>
>> So the question is whether generating a semantic tree that is not Antlr
>> specific is a viable alternative.  I think it is.  And we can still
>> provide
>> hand written listener and or visitor for processing this.
>>
> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
>


More information about the hibernate-dev mailing list