[antlr-interest] AST, value manipulation.

John D. Mitchell johnm-antlr at non.net
Thu Nov 18 09:42:28 PST 2004


>>>>> "Bharath" == Bharath Sundararaman <bharath.sundararaman at starthis.com> writes:
[...]

> That's exactly what I am trying to do! In order to decide if the array
> index value is statically known, I have to store the value someplace and
> have a check for

Depending on your language, you also have to know if the size of the array
is static or not.


> IF variable_value is known Check if it complies with the array range

> Can you give me some pointers/links/information that can help me achieve
> this? I searched the web and looked at some books in vain. Is this static
> analysis not regular practice? This is the first time I'm writing a
> compiler, please bear with me if you find my questions naïve.

You might want to look for the more general notion of "use-def" (and
"def-use") chains.  I.e., you link together the uses of each variable with
it's definition.

Of course, it would probably be wise to start with basic "constant
propagation".

Hope this helps,
		John



 
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