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

https://github.com/cappe987/python-code-generator

An F# combinator to generate randomized Python code.
https://github.com/cappe987/python-code-generator

code-generation fsharp python

Last synced: 30 days ago
JSON representation

An F# combinator to generate randomized Python code.

Awesome Lists containing this project

README

          

# Python code generator

An F# combinator to generate randomized Python code. [View example output.](output/example.py)

The parameters can be adjusted in `settings.json`.

The `"depth"` parameter is the amount of nested statements the code is allowed to have.
The rest are how common each statement should be, in relation to the others.
If all are set to the same value they have equal chance to occur in the code.

The file `words.txt` is the source for all variable names and strings.

Code is by default outputted to `output/output.py`.

# To-do list
- [x] `if` and `else` statements
- [x] Assignment expressions
- [X] More reasonable integers
- [X] Comparative expressions (`<`, `>`, `==`, `<=`, `>=`) and overall better boolean expressions
- [ ] More syntax (`for`, `while`, etc.)
- [ ] Functions
- [ ] More settings (occurrance of types, length of blocks, expression depth)
- [ ] Floats
- [ ] Remove char type and integrate it into strings
- [ ] Clean up Variables.fs
- [ ] Overall more human-like code
- [ ] Monad of Code type