+/EE379K
programming paradigms
git clone https://git.julia.blue/+/EE379K
5a7dde3
master
files
| gradle/wrapper/ | |
| src/main/java/cfg/ | |
| tests/ | |
| .gitignore | 103 B |
| FEEDBACK.txt | 189 B |
| README.md | 1.2 KiB |
| build.gradle | 695 B |
| cfg.txt | 845 B |
| gradlew | 5.9 KiB |
| run.sh | 37 B |
| run_all.sh | 269 B |
Instructions
Running run_all.sh will build CFGs for all of my test inputs. I hand inspected them to ensure correctness so there is no automated checker. The easiest way to check if a given CFG is correct is to look at the graph of basic blocks in a graphical form so I've included a command in the script to output .pngs for each one for this purpose. For this to work the system must have the dot utility available (usually found in a graphviz package)
The script run.sh takes a single .class file as an argument and outputs the corresponding CFG in ${filename}.cfg.
Assumptions
- Exception handling (try/catch/finally) isn't within the scope of this assignment as they require more semantic analysis to determine if a given sequence of instructions can throw or not.
- Since creating non-primitives requires calling a function (the constructor), the code will only contain primitive data types.
returninstructions all jump to a single "final" basic block, even if they're the last instruction in the function- The IDs of the basic blocks produced don't need to be in any particular order (I use
0for the final one and1for the starting block).