* ASIS question: How to detect branches of if statments?
@ 2005-04-06 2:05 Peter C. Chapin
2005-04-13 0:56 ` Stephen Leake
0 siblings, 1 reply; 2+ messages in thread
From: Peter C. Chapin @ 2005-04-06 2:05 UTC (permalink / raw)
Hi! I'm attempting to build an ASIS application. In my application I
need to construct a control flow graph (CFG) of, for example, a
particular procedure. For now I'm restricting myself to procedures with
if/else statements and simple loops without internal exit statements.
This is a class project so complete coverage of Ada is definitely not
necessary.
I see how to create the CFG for the loops. I provide pre and post
traversal procedures. For ordinary statements I attach a new node to a
"working point" in my graph. When I encounter a while loop (say), I
create a node for the predicate and push the node on a stack. When I
come to the end of the loop (in my post traversal procedure), I pop the
stack and connect the last node of the loop body to the header node,
etc.
I can do something similar to handle an if statement with a single
clause. But I'm stuck on how to handle if/else statements:
if X = Y then
-- Stuff.
else
-- Other stuff.
end if;
I can see the beginning of the if statement and I can see the end of it
("end if") but the traversal returns "stuff" and "other stuff" in one
continuous stream without any obvious indication where the else fits
into things. Clearly I'm missing something, but I'm not sure what. I saw
some things about "Statement Paths" in the Asis.Statements package spec,
but there isn't a lot of explanation about what they are. Is that
something I should be playing with?
I've looked at a couple of ASIS tutorials and they were helpful in
getting me started, but it seems like I'm going to need some more
detailed information now. Does anyone have any suggestions for a good
tutorial that might fit where I'm at?
Thanks!
Peter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ASIS question: How to detect branches of if statments?
2005-04-06 2:05 ASIS question: How to detect branches of if statments? Peter C. Chapin
@ 2005-04-13 0:56 ` Stephen Leake
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Leake @ 2005-04-13 0:56 UTC (permalink / raw)
To: Peter C. Chapin; +Cc: comp.lang.ada
I've done some ASIS stuff, but I have not done statement traversals
yet. I'm surprised you don't get something for the 'else'.
You should ask on the SIGAda ASIS mailing list. See
http://www.acm.org/sigada/wg/asiswg/asiswg.html (near the bottom of
the page, under "Becoming Involved" to join.
--
-- Stephe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-13 0:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-06 2:05 ASIS question: How to detect branches of if statments? Peter C. Chapin
2005-04-13 0:56 ` Stephen Leake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox