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.
- Host: GitHub
- URL: https://github.com/cappe987/python-code-generator
- Owner: cappe987
- Created: 2019-08-28T18:56:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-23T17:22:52.000Z (over 6 years ago)
- Last Synced: 2025-03-21T16:57:54.898Z (about 1 year ago)
- Topics: code-generation, fsharp, python
- Language: F#
- Homepage:
- Size: 289 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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