https://github.com/narendraysf/ast2db
AST2DB is a powerful tool that utilizes clang to parse C/C++ source code, extract Abstract Syntax Tree (AST) information, and store it in an SQLite database.
https://github.com/narendraysf/ast2db
ast c code-parsing compiler-tool cpp sqlite syntax-analysis
Last synced: about 1 month ago
JSON representation
AST2DB is a powerful tool that utilizes clang to parse C/C++ source code, extract Abstract Syntax Tree (AST) information, and store it in an SQLite database.
- Host: GitHub
- URL: https://github.com/narendraysf/ast2db
- Owner: NarendraYSF
- Created: 2025-02-02T08:13:07.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-21T06:51:44.000Z (3 months ago)
- Last Synced: 2025-03-29T06:44:54.661Z (about 2 months ago)
- Topics: ast, c, code-parsing, compiler-tool, cpp, sqlite, syntax-analysis
- Language: C++
- Homepage:
- Size: 27.3 KB
- Stars: 22
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AST2DB
AST2DB uses `clang` to parse C/C++ code and stores AST node information into an SQLite database.
## Dependencies
- [clang](https://clang.llvm.org/)## Development Environment
Current development is completed in the following environment:
- **Operating System**: linux-x86_64
- **Compiler**: g++ (gcc version 14.2.1)
- **Dependencies**
- **clang**: clang version 19.1.7## Usage
```bash
$ make # Compile
$ make help # View help information
$ ./build/demo # Run
```### Example
Using `./tests/slight.cc` as the target file for testing:
```bash
$ ./build/demo ./tests/slight.cc
```## Features
- [ ] Parse C/C++ code
- [x] Record variable declaration & reference nodes
- [x] Record function declaration & call nodes
...
- [ ] Store AST node information in an SQLite database
- [ ] Support exporting query results as CSV files
...