Reference no: EM132667111
Below you find a properly tested source that should be passed an analyzer for generating a CFG (Control Flow Graph) view saved as PNG or JPG image.
This is an assignment in which you need to manage following steps:
1) make a C++ analyzer program to build and walk AST using recursive visiting algorithm (no auxiliary software is allowed here, this program must be created without tools like compilers, lexers, llvm, clang etc - it's a key task to be managed);
2) program created in step 1 should be compiled to an '.exe' file. It receives a single argument via command line interface, specifically a name of cpp file containing program posted below
3) once argument passed appropriately via command line, running executable performs parsing and walking AST build from source below to pick data (blocks) which are necessary for building AST;
4) this process is expected generating a single result - that's a PNG or JPG image visualizing cpp source as a control flow graph.
5) If image file is created properly (it provides with view of CFG) then job outcome is just what I need so it looks things are right to finish.
NOTE:
Focus is required on facts as follows:
- analyzer can be written in C++, C, Java or Python, essentially it should build CFG for any C++ programs which are passed into executable code
- no compilers, lexers, already existing analyzers and whatever tools for instant AST or CFG building are allowed here - DO PARSING AND WALKING AST WITHOUT ANY EXTERNAL SOFTWARE, only using recursive visiting algorithm (other walking algorithms can be OK if they are applicable for walking AST without existing software)
- C++ analyzer program must cover following instructions:
1) if / else
2) while
3) for
4) switch / case
5) break;
6) continue
7) return
Unless all of them can be recognized and processed by the program to build CFG, work result to be considered as incomplete and dissatisfactory
Expected solution: a C++ analyzer source which can be compiled by g++ to executable file. It receives cpp program like one posted in this file, generates only PNG- or JPG-formatted image of control flow graph for all functions inside of source analyzed at once.
Attachment:- Core.zip