visualizer
所属分类:自动编程
开发工具:Python
文件大小:58KB
下载次数:0
上传日期:2022-05-29 03:25:56
上 传 者:
sh-1993
说明: 用于教育、代码分析和娱乐的C++Python代码的快速可视化。
(Quick visualization of C++ Python code for Education, code Analysis and Fun.)
文件列表:
examples (0, 2022-05-29)
examples\segment_tree (0, 2022-05-29)
examples\segment_tree\code.cpp (2996, 2022-05-29)
examples\segment_tree\image.webp (44534, 2022-05-29)
requirements.txt (41, 2022-05-29)
visualizer.py (1247, 2022-05-29)
visualizer (0, 2022-05-29)
visualizer\__init__.py (44, 2022-05-29)
visualizer\cpp_specific_functions.py (3152, 2022-05-29)
visualizer\tree_objects.py (9174, 2022-05-29)
visualizer\utils.py (2143, 2022-05-29)
visualizer\visualizer.py (28919, 2022-05-29)
Project L.A.B.Y.R.I.N.T.H
## Description:
This project aims to make a quick visual representation for a C++ project (though Python support is planned).
Possible use-cases:
* Showing visual representation of different code structures for teaching
* Code dependency analysis
* Per-function code structure analysis.
* (PLANNED) Performance analyzing
* (PLANNED) Unit-test and security analysis
## Instalation:
```
sudo apt install llvm
sudo apt install libclang-11-dev
git clone git@github.com:codereptile/visualizer.git
pip3 install -r requirements.txt
```
## General usage:
```shell
python3 visualizer.py cpp --target examples/segment_tree --scale 0.5
```
**You can also use `-b` or `--bruteforce` to avoid errors.**
## Keyboard control:
UP, DOWN, LEFT, RIGHT - move respectively
0 - increase size (zoom in)
9 - decrease size (zoom out)
## About colors:
```
Loops are Red,
Code lines are Blue,
Sugar is Sweet,
And so are you.
```
Btw, Functions are Grey, Ifs are green with a black line separating main statement and else.
All other black lines are function calls.
## Examples:
### [Segment tree](https://github.com/codereptile/visualizer/blob/main/examples/segment_tree/code.cpp):
![screenshot](https://github.com/codereptile/visualizer/blob/main/examples/segment_tree/image.webp)
## FAQ:
What are you using for parsing C++?
— Clang
Why not use `
`?
—Because parsing C++ propely requires almost compiling it,
so only by using a compiler can we get a 100% correct output.
Easiest example is `operator <<` which in most parsers is registered as a `binary expression`, when in reality it is a `function call`.
## Known bugs // missing features:
* Function calls inside Loop and If conditions are not registered
* No way to see actual code from visualizer
* Function arguments not registered
* Python support is yet to come
* No way to see how many times a function is called from a single line
* No support for outside-of-function code
* No way to resize/move in editor
* It's hard to tell code structure if there are many If statements
* Class / struct constructors are not registered as function calls
* **If an included library is not found, some code may be absent!!! (this can be partually avoided by commenting the problematic include)**
* No way to add libraries that shouldn't be rendered
* No switch case support
* Operator calls are not detected, even if they are user-defined
* On large projects moving/resizing is quite CPU-intensive and takes significant time (projects of around 1500 lines of code are rendered at around 7-8 FPS (125-150ms response time))
近期下载者:
相关文件:
收藏者: