[antlr-interest] Re: Translators Should Use Tree Grammars

atripp54321 atripp at comcast.net
Tue Nov 23 08:35:51 PST 2004



--- In antlr-interest at yahoogroups.com, "Anthony Youngman"
<Anthony.Youngman at E...> wrote:
> Let's see your pattern match cope with the following line of
(*real*)
> code from a (*real*) language ...
> 
> REM: REM = REM( 85, 17) ;* REM calculate the remainder
> 
> Where REM is sequentially a label, a variable, a function, and a
> statement. I think that pretty much this statement is in the
compiler's
> regression tests to make sure it works properly :-)
> 
> Cheers,
> Wol

The way Jazillian handles it is this.
The ANTLR-generated parser will remove the comment (but
not before I save it, and I'll restore it at the end).
My GotoRemoverRule removes all labels and gotos.
My findAllVariableReferences() will include the variable
reference, but not the function call, and my findAllFunctionCalls()
method will find just the function call. Both these methods
look at local syntax (the "(" following) to figure out
whether it's a function call or a variable reference.

I know, you're all cringing :(

Andy





 
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