https://github.com/christimperley/pythoncgum
A Python implementation of the CGum AST
https://github.com/christimperley/pythoncgum
Last synced: over 1 year ago
JSON representation
A Python implementation of the CGum AST
- Host: GitHub
- URL: https://github.com/christimperley/pythoncgum
- Owner: ChrisTimperley
- License: mit
- Created: 2016-08-26T00:11:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-17T04:02:34.000Z (over 9 years ago)
- Last Synced: 2025-01-03T19:17:48.743Z (over 1 year ago)
- Language: C
- Size: 818 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyCGum
A Python implementation of the CGum AST
## Usage
Generate a CGum AST for a given file as shown below:
```
program = Program.from_source_file("example.c")
```
Alternatively, an AST may be produced from a GumTree JSON AST output file,
produced using `gumtree parse example.c`.
```
program = Program.from_gumtree_file("example.gumtree.json")
```
ASTs, or even partial sub-trees may be loaded manually using the method shown
below, where `jsn` is a JSON file loaded into a Dict object.
```
node = Node.from_json(jsn)
program = Program.from_json(jsn)
```