[antlr-interest] DFA's encoded directly in java bytecodes

Terence Parr parrt at cs.usfca.edu
Tue Oct 26 15:55:53 PDT 2004



On Oct 26, 2004, at 1:46 PM, Robert Colquhoun wrote:
> At 06:13 AM 26/10/2004, Terence Parr wrote:
>> As I say though I wondered about breaks at first, but then decided 
>> that
>> bytecodes were the only general way to get the gotos.  I do have a 
>> nice
>> little assembler and class file writer now for ANTLR that, while not
>> completely general, it's damn small.  Assembler and .class file writer
>> are each about 600 lines.  Could be useful for users of antlr as well
>> as the tool itself.
>
> With all the goto'ing I was just wondering if the assembler you have 
> done
> above implements the bytecode rule "all approaches to a single point 
> must
> have the same stack"

Well, do you mean that I guarantee/check for this?  nope ;)  My DFA 
code will keep the stack at 0 minus locals / arguments between states.

> This was quite hard for me to do, i have a java bytecode 
> generator(about
> 2500 lines ;-) that i was going to use to produce a bytecode tree 
> walker to
> compile antlr grammars starting from BNF without the java source
> intermediate step.
>
> I was stuck on action code and how to do semantic actions, its easy to 
> do
> as separate actions but hard to do inline.

True, but you could invoke the javac compiler in tools.jar like a web 
server :)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
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