Reputation: 21
I want to get a control flow graph of a code/program (be it any programming language and given its grammar). I have tried using lark library in python to parse a basic C sample program [I provided the grammar for basic c syntax to lark]. As a result, it gave me an object of parse tree or similar sort of stuff, now I am wondering where to proceed.
Having said that, any kind of new approach is highly appreciated. The prime goal is to get the control flow graph of a code/program, given the grammar of the language in which it is written.
Upvotes: 2
Views: 2008
Reputation: 370425
As a result, it gave me an object of parse tree or similar sort of stuff, now I am wondering where to proceed.
A common approach is to
The prime goal is to get the control flow graph of a code/program, given the grammar of the language in which it is written.
You can't get the CFG of a program if all you know about the language is its grammar. You'll need some understanding of the semantics of the language to be able to construct a CFG.
Upvotes: 3