https://github.com/mariusschulz/styx
Derives a control flow graph from a JavaScript AST.
https://github.com/mariusschulz/styx
Last synced: 9 months ago
JSON representation
Derives a control flow graph from a JavaScript AST.
- Host: GitHub
- URL: https://github.com/mariusschulz/styx
- Owner: mariusschulz
- License: mit
- Created: 2015-06-06T09:44:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-11-23T23:16:58.000Z (about 4 years ago)
- Last Synced: 2025-04-07T18:11:36.341Z (9 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.09 MB
- Stars: 63
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# styx
Derives the control flow graph from a JavaScript AST in [ESTree](https://github.com/estree/estree) format.
> This project was created as a proof-of-concept implemention for my Bachelor's thesis in computer science:
>
> - [Deriving Control Flow Graphs from JavaScript Programs](https://github.com/mariusschulz/bachelors-thesis/blob/master/thesis.pdf)
## Install
```
$ npm install styx
```
## Usage
With the `esprima` and `styx` npm packages installed, Styx can be used as follows:
```js
import Esprima from "esprima";
import * as Styx from "styx";
var code = "var x = 2 + 2;";
var ast = Esprima.parse(code);
var flowProgram = Styx.parse(ast);
var json = Styx.exportAsJson(flowProgram);
console.log(json);
```