https://github.com/bstee615/tree-climber
Program analysis tools built on tree-sitter (https://github.com/tree-sitter/tree-sitter).
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.6%) to scientific vocabulary
Keywords
Repository
Program analysis tools built on tree-sitter (https://github.com/tree-sitter/tree-sitter).
Basic Info
Statistics
- Stars: 43
- Watchers: 2
- Forks: 12
- Open Issues: 8
- Releases: 2
Topics
Metadata Files
README.md
tree-climber
Tree Climber is a comprehensive static analysis framework for generating Control Flow Graphs (CFGs) and performing dataflow analysis on source code. It supports multiple programming languages through Tree-sitter parsers and provides both programmatic APIs and interactive web visualization.
Goals
- Clean architecture and thorough test coverage.
- Semi- (and eventually fully-)automated analyses written by coding agents.
- Interactive, detailed, high-quality visualizations for educational and exploration purposes.
Supported Languages
- C: Full CFG generation with control structures, loops, and functions
- Java: CFG generation for Java language constructs
- Extensible: Framework designed to easily add new language support
Architecture
Core Components
- CFG Builder: Generates control flow graphs using visitor pattern
- Dataflow Solver: Implements iterative dataflow analysis algorithms
- AST Utils: Tree-sitter integration and AST manipulation utilities
- Visualization: Web-based interactive CFG visualization
Analysis Capabilities
- Control Flow Analysis: Statement-level CFG construction
- Def-Use Chains: Variable definition and usage tracking
- Reaching Definitions: Forward dataflow propagation
- Extensible Framework: Support for custom dataflow analyses
Installation
This project uses uv for Python dependency management and bun for frontend dependencies.
Prerequisites
Setup
Clone the repository:
bash git clone https://github.com/bstee615/tree-climber cd tree-climberInstall dependencies: ```bash
Install dependencies on Ubuntu
sudo apt install -y graphviz graphviz-dev uv sync ```
(For web frontend) Install frontend dependencies:
bash cd src/tree_climber/viz/frontend bun install(For CLI) Install CLI dependencies:
bash source .venv/bin/activate uv pip install -e .
Usage
CLI
CLI is available as a command, tree-climber. Run the CLI against a file or directory. Use the flags below to pick which graphs to generate and how to render them.
Example:
bash
tree-climber test/example.c --draw_cfg --draw_cpg
Example CFG | Example CPG (Code Property Graph, including AST + CFG + DFG edges)
-- | --
| 
An alternative view of the CPG is available which draws the AST and CFG separately, with edges connecting CFG <-> AST nodes. Use the option -L bigraph.
Example bigraph CPG

Try tree-climber --help to see all options.
Web Application
The project includes a webapp for visualizing and interacting with CFG/DFGs, inspired by https://godbolt.org. To run it easily, open the project in VSCode and launch the config named "Run Server and Frontend".
Start the Backend Server
```bash
Run FastAPI server with hot reload
uv run -m uvicorn tree_climber.viz.app:app --reload --host 0.0.0.0 --port 8000
Or use the VS Code task: "Run FastAPI Server"
```
Start the Frontend
```bash
Navigate to frontend directory
cd src/tree_climber/viz/frontend
Start development server
bun dev
Or use the VS Code task: "Run Frontend"
```
Access the Application Locally
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
API Endpoints
The FastAPI backend provides the following endpoints:
POST /parse- Parse source code and return CFG in JSON formatPOST /analyze/def-use- Perform def-use chain analysisPOST /analyze/reaching-definitions- Perform reaching definitions analysisGET /health- Health check endpoint
Limitations
Currently, only basic program constructs are supported. I am working to make the parsing more robust and complete.
See the full list of features handled and planned in the Limitations section of this doc.
Development
Adding New Languages
- Create a new visitor class in
src/tree_climber/cfg/languages/ - Implement language-specific CFG construction logic
- Register the language in the CFG builder
- Add test cases in the
test/directory
Adding New Analyses
- Create a new analysis class in
src/tree_climber/dataflow/analyses/ - Implement the dataflow problem interface
- Add API endpoints in
src/tree_climber/viz/app.py - Update frontend to display analysis results
Frontend Development
The frontend is built with: - React: UI framework - Cytoscape.js: Graph visualization - Monaco Editor: Code editing - Vite: Build tool and dev server
Backend Development
The backend uses: - FastAPI: Web framework - Tree-sitter: Source code parsing - Pydantic: Data validation
CLI Development
The CLI uses: - Typer: Terminal display and argument parsing - GraphViz: Graph visualization
Documentation
For detailed technical documentation, see the docs/ directory:
Owner
- Name: Benjamin Steenhoek
- Login: bstee615
- Kind: user
- Website: benjijang.com
- Repositories: 12
- Profile: https://github.com/bstee615
3rd year PhD student @ ISU. Interests and research: deep learning, program analysis
GitHub Events
Total
- Release event: 1
- Watch event: 12
- Push event: 12
- Pull request event: 4
- Fork event: 3
- Create event: 2
Last Year
- Release event: 1
- Watch event: 12
- Push event: 12
- Pull request event: 4
- Fork event: 3
- Create event: 2
Committers
Last synced: over 3 years ago
All Time
- Total Commits: 156
- Total Committers: 1
- Avg Commits per committer: 156.0
- Development Distribution Score (DDS): 0.0
Top Committers
| Name | Commits | |
|---|---|---|
| Benjamin Steenhoek | b****k@g****m | 156 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 13
- Total pull requests: 11
- Average time to close issues: 7 days
- Average time to close pull requests: 1 day
- Total issue authors: 4
- Total pull request authors: 2
- Average comments per issue: 0.46
- Average comments per pull request: 0.09
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 6 days
- Issue authors: 0
- Pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- bstee615 (10)
- jeffyjeff2893 (1)
- phimachine (1)
- smith-co (1)
Pull Request Authors
- bstee615 (10)
- yuxuan-z19 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 12 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
pypi.org: tree-climber
Program analysis tools built on tree-sitter.
- Homepage: https://github.com/bstee615/tree-climber
- Documentation: https://tree-climber.readthedocs.io/
- License: MIT License Copyright (c) 2022 Benjamin Steenhoek Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.0.1
published almost 4 years ago
Rankings
Maintainers (1)
Dependencies
- GitPython *
- black *
- matplotlib *
- networkx >=2.5
- pydot *
- pygraphviz *
- pytest *
- tree-sitter >=0.20
- GitPython *
- matplotlib *
- networkx *
- pygraphviz *
- tree-sitter *