An open API service indexing awesome lists of open source software.

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

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)
```