[antlr-interest] Re: alternative prediction mechanism for 3.0

antlrbrian brian-l-smith at uiowa.edu
Sat Jul 3 17:06:04 PDT 2004


--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
> 
> On Jul 2, 2004, at 4:07 PM, antlrbrian wrote:
> 
> > --- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> >> Terence wrote:
> >>> DFA decision = dfaFactory.get("...DFA description...");
> >>
> >> You mean to have a 'high' level ASCII DFA specification of
> >> states/transitions etc. between the ".." or just an id for tha
> >> specific DFA?
> >>
> >> Why not encode the DFA in static tables (that can be 'run'
> >> directly without first processing them)?
> >> There's lot's of ways to do that if I recall right.
> >> It also offers the possibility to dump the tables in separate
> >> class files (if size becomes an issue).
> >
> > Why not generate the DFA to a textual representation, and then compile
> > that textual representation to bytecodes. My thinking is:
> > 1. The DFA textual representation will be easier to read than
> >    generated Java code.
> > 2. Using the new Java debugging API's (JSR 45), the classfiles
> >    can be generated in such a way that debuggers can trace
> >    through the DFA's textual representation directly.
> > 4. The JVM GOTO instruction (and other such things) can be used
> >    to speed things up if necessary.
> > 5. It is a good demo of ANTLR's ability to generate tools
> >    that generate binary output. I've only seen source-to-source
> >    or source-to-AST translators in ANTLR.
> 
> Hi Brian,
> 
> A nice idea, one I had considered (generating bytecodes directly 
> that is).  Problem people mentioned is that the start up cost is 
> pretty expensive for the parser to build/generate the 
> bytecodes...probably not an issue for many people, but...

I meant, you could generate the bytecodes at the same time that you
are doing the grammer -> source code translation. That is, antlr.Tool
would have a "compile DFA to bytecodes" stage. Sorry this wasn't clear
in my previous post.

- Brian





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list