Skip to main content

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

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:

dronestate appveyor codecov docstate

Metadata

Release files for ppci 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for ppci 0.5.1
File Size Uploaded
ppci-0.5.1.zip 307.5 kB Details
ppci-0.5.1.tar.gz 249.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ppci 0.5.1
File Interpreter ABI Platform
ppci-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 826.9 kB

Release files / ppci-0.5.1.zip

Download URL ppci-0.5.1.zip
Size 307.5 kB
Tags Source
SHA-256 checksum
How to use checksums
965134a9812dc81cefce8658b8b5181195627765afdb390297f753c54e70ca45
BLAKE2b-256 checksum
How to use checksums
d791539fc9d8d05cda896ead866ff560ed2be1b40354bc3f955de7d684f9eb6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ppci-0.5.1.tar.gz

Download URL ppci-0.5.1.tar.gz
Size 249.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b95a2c76640de9fec8d479a956a870ba9f70c5432a5030229c72ced51c00754a
BLAKE2b-256 checksum
How to use checksums
df5b812935855ef4bc11ab3d7fb43a7094e8a1f120a0914aa35cc8b6c56bf571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ppci-0.5.1-py3-none-any.whl

Download URL ppci-0.5.1-py3-none-any.whl
Size 269.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d23010caa2a8c011fe4555c5419603f5e616b3fbaea77ce354600d3d966d877e
BLAKE2b-256 checksum
How to use checksums
4d460ba36dea9a53a7d10ac9dc51be1ac5a9852c71273382cbdfc2d13bb6f014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

This release

0.5.1 This release

3 release files

0.5

2 release files

0.4.0

2 release files

0.3.0

1 release file

0.2.0

0.1.0

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page