a macro library that expoes the bytecode of python
Project description
bytecode macro lib
exposes (a slightly modified version of) the bytecode of a function to allow for run-time modification of python syntax.
how to use
for a description of how to use and install the program, please go to the docs folder on the github (https://github.com/Glubs9/bytecodemacro).
cool example to get you excited
this is a cool example to get you excited with what this library could do and the fun you can have doing it.
@macro(cloop)
def test():
_ = "for c = 0;c < 10;c+=1"
print(c)
_ = "end"
test()
#this prints 1 to 10!
isn't this just really cool, please have fun writing your own macros! or just have fun looking at the examples in docs/examples.py in the github
todo
- allow for uncompile and the compile packages to be used independently on files for other cool stuff (maybe)
- increase code re-use
- clean code of stuff that isn't used from when this was a different project (all the file stuff and header.py and tests)
- add error / semantics checking for the returned bytecode (maybe)
- add more examples
- optimization macros?
- steal from examples of lisp macros
- byte_compile is just soooooo buggy
- brackets in strings that are bytecompiled don't work for some reason
- add handling for newly created variables in byte_compile to use store_fast rather than store_name
- it doesn't compile in the calling scope so it can lead to some wacky situations (variables not recognized)
- test and then handle encountering the extended arg instruction in the uncompile package
- test the (end, 0) tuple is not causing any bugs in the bytecodecompile package
- i'm not 100% on if compare_op is being uncompiled to the string representation
- check that setup_finally handles jumps properly and still doesn't use delta
- i am also still lost on closures and co_freevars so if you could get to that it would
be helpful
- test if the macro decorator works on lambdas
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bytecodemacro-2.0.2.tar.gz
(25.4 kB
view hashes)
Built Distribution
Close
Hashes for bytecodemacro-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50c773c731bd3c7d7ec0345798b663acc298ad94cd591533100cf95b2c64080f |
|
MD5 | 2b50546c257494426310fd4be0ff4f72 |
|
BLAKE2b-256 | 5dbf9377541176340f0e8bbd4f9d35ceab504d31f656c8b9589a84fd12431122 |