Skip to main content

Pure python compiler infrastructure

Project description

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: arm, avr, msp430, x86_64

Command line tools

Use it to build projects:

$ pip install ppci
$ ppci-build.py -f examples/build.xml
$ qemu-system-arm -M lm3s6965evb -kernel snake.bin -serial stdio

This runs the snake demo on an emulated (qemu) lm3s demo board and displays the game to the console.

Api

Or use the api:

>>> from ppci.arch.x86_64 import instructions, registers
>>> i = instructions.Pop(registers.rbx)
>>> i.encode()
b'['
>>> import io
>>> from ppci.api import asm
>>> source_file = io.StringIO("""section code
... mov rax, 60
... mov rdi, 42""")
>>> obj = asm(source_file, 'x86_64')
>>> obj.get_section('code').data
bytearray(b'H\xb8<\x00\x00\x00\x00\x00\x00\x00H\xbf*\x00\x00\x00\x00\x00\x00\x00')

Documentation

Documentation can be found here:

dronestate appveyor codecov docstate version devstate pyimpls pyversions license downloads

Project details


Supported by

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