My observations so far: Don't assume that you can handle everything using Anltr's build in mechanisms: semantic & syntactic predicates are powerful, but they are emphasized too much, so it makes you try to solve all problems with them. I guess the reason people can use JavaCC easier is that there is not this much specific features, so less confusion.
Also, if you try to solve problems with specific token declaration in the lexer, parser rules become complicated very quickly, because all types of tokens are sent to parser rules, and parser rules become complicated as a result. My feeling at the moment is, if you're using Antlr for Aql, keep the lexer rules small, and handle most of the work in parser rules. Once I make some more progress, I'd really like to discuss in depth with authors of JavaCC based parsers. On Fri, Jan 13, 2012 at 11:46 AM, Bo?tjan Lah <bostjan.lah at marand.si> wrote: > ** > Hi, > > I found both left recursion as well as other aspects of ANTLR quite tricky > esp as I had very little experience with ANTRL and grammars in general. > There is also no "quick and dirty" way to do it - books on the subject are > quite hefty [image: :-(] > Anyway, I am really looking forward to another ANTLR grammar - perhaps we > can merge both at the end and come out with one that works for really all > cases. > > Kind regards, > Bostjan > > > On Fri, 2012-01-13 at 11:10 +0000, Seref Arikan wrote: > > Thanks Mikael, > I've also found left recursion to be less of a problem as I focused on the > grammar. The details, and especially the division of tasks between lexer > and parser in Antlr is what is tricky, as you've also pointed out. > > I decided to keep working on my version without peeking at any other work, > to see what comes out of that (probably lots of things to laugh at). There > is now already an Antlr grammar out there, thanks to Marand, but I find the > idea of having multiple works out there very exciting. 2012 has certainly > started well for the openEHR community! > > Best regards > Seref > > > 2012/1/13 Mikael Nystr?m <mikael.nystrom at liu.se> > > Hi, > > > > I used the standard approach for rewriting left recursion to non left > recursion described in computer grammar books (and in Wikipedia > http://en.wikipedia.org/wiki/Left_recursion). It was a quite straight > forward translation, but it was necessary to be careful with all the > details. :-) We will share the grammar when we have cleaned up the file a > little more. > > > > Regards, > > Mikael > > > > > > *From:* openehr-technical-bounces at openehr.org [mailto: > openehr-technical-bounces at openehr.org] *On Behalf Of *Erik Sundvall > *Sent:* den 5 januari 2012 11:12 > *To:* For openEHR technical discussions > *Subject:* Re: Did anybody implement AQL with a LL parser framework? > > > > > Hi! > > > > > We implemented an AQL parser using JavaCC. My colleague Mikael Nystr?m > made some transformations to make the published AQL grammar work in JavaCC. > Mikael is on vacation right now, but I'm sure he does not mind sharing his > experiences once he gets back. > > > > > > I do think it would be interesting to switch to ANTLR sooner or later > in order to share efforts between projects with different > implementation/target-languages and because the ANTLRWorks environment > http://www.antlr.org/works/index.html looks promising compared to the > pretty bad JavaCC-plugin in e.g. Eclipse. > > > > > > Our parser (and thus also the modified grammar) will soon be open > sourced so you are free to use it. So if you are not in an extreme hurry > I'd suggest using or getting inspiration from what we have already done. > > > > > > Best regards, > Erik Sundvall > erik.sundvall at liu.se http://www.imt.liu.se/~erisu/ Tel: +46-13-286733 > > > > On Wed, Jan 4, 2012 at 16:37, Seref Arikan < > serefarikan at kurumsalteknoloji.com> wrote: > > Greetings, > The AQL grammar from the wiki has direct and indirect left recursion. > Which means without changes in the grammar, LL parser generators (both > JavaCC and Anltr) can't generate parsers for this grammar. > > I'm curious if anybody has refactored this grammar for LL parser > generators. Shinji? Your latest release includes an AQL parser does not it? > Could you please share your method? I can always look at the code, but > you'd probably save me time :) > > I'm interested in experiences of others too. > > > Kind regards > Seref > > > > _______________________________________________ > openEHR-technical mailing list > openEHR-technical at openehr.org > http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical > > > _______________________________________________ > openEHR-technical mailing listopenEHR-technical at > openehr.orghttp://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical > > > > _______________________________________________ > openEHR-technical mailing list > openEHR-technical at openehr.org > http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.openehr.org/mailman/private/openehr-technical_lists.openehr.org/attachments/20120113/59e8c0f0/attachment.html>

