[antlr-interest] Get a Control flow graph(CFG) from the AST

Sarnath K - ERS, HCLTech k_sarnath at hcl.com
Thu Dec 2 01:45:01 PST 2010


Hi Alan,

Here is how we are doing it. Courtesy: Vaibhav Goel from our group.
"
Traverse the AST and create CFG nodes and edges, taking special care for branching and looping constructs. For example, on
reaching an 'if' statement, create two separate routes for 'then' and 'else' blocks. Similarly, on reaching a 'for' statement,
create a back edge to account for looping.

Surely, this ab initio approach is lengthy and might also get a bit messy once
function calls are in place (which I have not considered for now).

However, I did not come across any alternative way of doing it for ANTLR on the net.
"
Thanks,

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Developer.Net
Sent: Thursday, December 02, 2010 12:26 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Get a Control flow graph(CFG) from the AST

Hello Everyone!

 What I want to do is to get a control flow graph(CFG) from an AST, where each
statement or expression is a unique Node. I was wondering what you would suggest
as the best option to do that. Thanks!

-Alan




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------



More information about the antlr-interest mailing list