On Sunday 05 June 2005 06:25 pm, Deryk Robosson wrote:
Rhys, can you offer any ideas or suggestions on this?
Every statement will need to have a list of variables used and set
associated
with it, with dynamic flow analysis used to track the usage. A flag is
insufficient. See the Dragon Book for the gory details. It ain't
pretty,
especially when statements like break, continue, and goto are
encountered.
It would perhaps be possible to add a "check usage" operation in treecc
that
collects up this list information for each node type. It would take a
list
of variables in, for those that have already been set, and produce a
list of
variables that are set afterwards. Set merging will need to be done
everywhere control flow might come in from other points.