Introduction
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, stm8, x86_64, xtensa
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.5.2
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.5.2.tar.gz | 274.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ppci-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 567.7 kB
Release files / ppci-0.5.2.tar.gz
| Download URL | ppci-0.5.2.tar.gz |
|---|---|
| Size | 274.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d020b6c913e3ae6c28b7480fbae6042be3b2d8e6d9898253e37984fcfd7a073
|
|
BLAKE2b-256 checksum How to use checksums |
65b99db71353785718eeb2f978bcb5e79b7e37e69f8a36f8b8ea6ddd7f504050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ppci-0.5.2-py3-none-any.whl
| Download URL | ppci-0.5.2-py3-none-any.whl |
|---|---|
| Size | 293.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a300b71983dd7beaac8c7d03dfe0738ac558e540e43a711f77bb25c3a5d4103
|
|
BLAKE2b-256 checksum How to use checksums |
ac915969493076141a1f8b44933e81c870fae345251d465e5067669142eb0ed1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |