db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: Need Help with JDOQL Compiler/Interpreter
Date Mon, 03 May 2004 18:04:25 GMT
hi thomas,

looks like you are the antl guru i'm looking for.
this is the post i made last october:


hi all,

while playing with oql i realized that we do not support functions !

         OQLQuery query = odmg.newOQLQuery();
         query.create("select anArticle from " +
                 Article.class.getName() +
                 " where upper(articleName) like \"A%\" ");


the upper-function in the where clause causes antlr errors:

line 1: unexpected token: upper
line 1: unexpected token: )

i tried to fix it by adding ( and ) to the valid characters for Identifier. but 
breaks in and is_defined.

after some hours of digging in oql-ojb.g i have to admit that i'm stuck.
so please antlr-gurus have a look at it.

jakob



Thomas Dudziak wrote:
> On Mon, 3 May 2004, Thomas Mahler wrote:
> 
> 
>>Hi Brian,
>>
>>The "real" way to deal with jdoql will be to use a parser-generator like 
>>ANTLR. The parser Generator will be able to take an EBNF-like grammar 
>>file and generate Java-programes implementing Lexer and Parser for the 
>>language defined by the EBNF.
> 
> 
> Brian, how soon do you need the grammar ? I could put together an Antlr
> grammar at the end of the week.
>  
> 
>>In my mind the procdure for JDOQL will be quite similar as for ODMG OQL.
>>That is the parser should translate from JDOQL to PB query/criteria objects.
>>We are defining all parsing rules in a grammar file (oql.g). Antlr will 
>>then generate the parser runtime classes from that grammar file.
> 
> 
> +1. In fact this makes it easy to test the grammar without even having a
> database at hand. The unit tests simply input a JDOQL statement into the
> parser and then check the resulting pb query.
> 
> 
>>As far as I remember there is an ANTLR grammar for JDOQL in the JDO RI.
>>This grammar could be a starting point for writing our own JDOQL -> 
>>Query/Criteria grammar.
> 
> 
> Nope, AFAIK, its only a recursive decent BNF of JDOQL which can be quite a
> hassle to convert into LL(k) (it surely was with the Java grammar).
> 
> Tom
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message