The ppci (pure python compiler infrastructure) project is a compiler written entirely in python.
The project contains the following:
A Compiler, an assembler, a linker and a build system
Language front-ends: Brainfuck, c3
Backends: 6500, arm, avr, msp430, risc-v, x86_64
Api
Api example to compile c3 code:
>>> import io
>>> from ppci.api import c3c, link
>>> source_file = io.StringIO("""
... module main;
... function void print(string txt) {
... }
... function void main() {
... print("Hello world");
... }""")
>>> obj = c3c([source_file], [], 'arm')
>>> obj = link([obj])
Example how to assemble some assembly code:
>>> import io
>>> from ppci.api import asm
>>> source_file = io.StringIO("""section code
... pop rbx
... push r10
... mov rdi, 42""")
>>> obj = asm(source_file, 'x86_64')
>>> obj.get_section('code').data
bytearray(b'[ARH\xbf*\x00\x00\x00\x00\x00\x00\x00')
Example of the low level api usage:
>>> from ppci.arch.x86_64 import instructions, registers
>>> i = instructions.Pop(registers.rbx)
>>> i.encode()
b'['
Documentation
Documentation can be found here:
Metadata
Release files for ppci 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ppci-0.4.0.tar.gz | 196.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ppci-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 406.6 kB
Release files / ppci-0.4.0.tar.gz
| Download URL | ppci-0.4.0.tar.gz |
|---|---|
| Size | 196.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c55cd8f3ecc2bb535b602d500e6923d5b4602e3d5f731ba374afb9b2880bd4f4
|
|
BLAKE2b-256 checksum How to use checksums |
67ad7069d90ef8bb22fbe61fce849b57d76f022c99285afd42ec9758c254a745
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ppci-0.4.0-py3-none-any.whl
| Download URL | ppci-0.4.0-py3-none-any.whl |
|---|---|
| Size | 210.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcc7fbd6fd9a7a989dc69b81c2718a876ce0423c952fa2b63e472bd67cef46ab
|
|
BLAKE2b-256 checksum How to use checksums |
10a4d17d8c45c3515f834e811446065a97194fc884167000e3bf8a7a2ceff1f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |