This is a simple program slicing tool in C and also for C programs to see depending lines of code.
Clone the code:
git clone https://github.com/feng01/ProgramSlicing.git
cd ProgramSlicing
./ProgramSlicing filepath/test.c #the second parameter is the code you want to analysis
Then input the slicing criterion : line number and variables.
The slice result will saved in the file named test_slice.c which is located in the same directory as test.c.
First, some software you need install:
- flex
- bison
- graphviz
On OpenSuse,you can use following command to install them:
sudo zypper install flex bison graphviz
Then, run make
to recompile the code you have modified.
The program doesn't support all of the C syntax,and need to further improve.
For example:
- fuction call doesn's support.
- Pointer does's support.
- You should use
i=i+1
instead ofi++
.
and so on.