Skip to main content

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!

please have fun writing your own macros! or just have fun looking at the examples in docs/examples.py in the github

todo

- 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
	- 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
- i am also still lost on closures and co_freevars

Project details


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.6.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bytecodemacro-2.0.6-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file bytecodemacro-2.0.6.tar.gz.

File metadata

  • Download URL: bytecodemacro-2.0.6.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for bytecodemacro-2.0.6.tar.gz
Algorithm Hash digest
SHA256 2fb0405eb9f969dbc39961190de7b2c3c7d93f0aa079f4cd8cf1fe480a102f7c
MD5 1097b7e8c516d0b800b6fe14fe70da4f
BLAKE2b-256 c8908170a2320fa12ef3e9b95d6ea4626dc5aa1c9d18b47307194763e4766f46

See more details on using hashes here.

File details

Details for the file bytecodemacro-2.0.6-py3-none-any.whl.

File metadata

  • Download URL: bytecodemacro-2.0.6-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0

File hashes

Hashes for bytecodemacro-2.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fe212586093721637c68e03c99058c806c6c9d21f4f1408e740bd6cf6bd180c9
MD5 b73a39cd62a44f59ec813968795a8da5
BLAKE2b-256 33d3512f9123c0627231d8cfad679fd1a6eab5f15d9cec0c5890a20dd4424b27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page