[antlr-interest] build issues: bytecode assembly generation

Bryan Ewbank ewbank at synopsys.com
Fri Oct 22 05:54:54 PDT 2004


> I just had another idea.  The original problem is "I need gotos in
> Java."

After all this, do you really need gotos?  How's about using a while/switch
combination instead?

It provides the same flexibility - bits of code executed in specific
orders - but avoids the need to hack the generated code.  It's also, at
least from what I've seen, the usual way to implement NFA/DFA with code
instead of tables.  For example...

	int state = START;
	while(state != END)
	{
	    switch (state)
	    {
	    case START:
	        ...
	        state=20;
	        break;
	    case 20:
	        ...
	        state=21;
	        if (...) state=42;
	        break;
	        ... ... ...
	    }
	}

This still keeps the "pretty much what you'd do by hand" model that ANTRL
uses for other parts of the generated code, and avoids the headaches of the
whole hacking-the-code problem.

-Bryan



 
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