Some interesting hints for AntLR and tool

节选自:http://tech.groups.yahoo.com/group/seajug/messages/16718?threaded=1&m=e&var=1&tidx=1

 

ANTLRworks and the ANTLR IDE plugin for Eclipse are behaving differently.
Running the same input through the same grammar using the same ANTLR jar.

 ======================

 For what it's worth I use ANTLRWorks and ANTLR a lot for my Fantom
Netbeans plugin ( http://fantomide.colar.net )

The debugger did work fine too and was very useful.

However, even with the debugger it was just too hard to get ANTLR to
work reliably the way I wanted (even with the book)

I later move to the parboiled parser:
https://github.com/sirthias/parboiled/

The grammar is "plain" (and simple) java code and that makes tooling
much better (standard java tools, IDE, Debugger, prodfiler and so on)

For example, you can see my old antlr impl here:
http://bitbucket.org/tcolar/fantomidemodule/src/tip/src/net/colar/netbeans/fan/a\
ntlr/obsolete/

and now with parboiled here:
http://bitbucket.org/tcolar/fantomidemodule/src/tip/src/net/colar/netbeans/fan/p\
arboiled/

I find working with plain Java code much easier(it's just code) and like
I said tooling doesn't even compare !
 
================================

Parboiled looks pretty cool. Thanks for the tip. I'll definitely give it whirl
for my next parsing project.



I've gotten my ANTLR v3 grammar for generic SQL working pretty well now. I'll
stick with ANTLR, for now, for these reasons:


#1 - Concision is a virtue, and my SQL grammar is now very terse. It should be
very easy for others to pick up.


#2 - ANTLR's killer feature is LL(*), meaning infinite lookahead. It's based on
Bryan Ford's packrat parsing algorithm (his extension to PEG). This allowed m to
completely removed semantic predicates from my grammar. (Inlined tests that
override ANTLR's default rule selection.) The result is awesome.


Having not used parboiled, nor hand coded parser expression grammars (PEGs), I
don't know what pitfalls lurk implementing a SQL grammar.



#3 - My Fado tool needs to support many dialects of SQL. The ANTLR community
already has grammars for Oracle, Microsoft, etc. I want to leverage that
collected wisdom.




 

你可能感兴趣的:(tool,职场,antlr,休闲,antlrworks)