Introduction¶
The ppci (pure python compiler infrastructure) project is a compiler written entirely in python.
The project contains:
- A compiler, an assembler, a linker and a build system
- Language front-ends: Brainfuck, c3
- Backends: 6500, arm, avr, msp430, ricv-v, x86_64
An example usage of the low level encoding api:
>>> from ppci.arch.x86_64 import instructions, registers
>>> i = instructions.Pop(registers.rbx)
>>> i.encode()
b'['
Another example:
>>> 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')
And yet another example:
>>> 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])
Warning
This project is in alpha state and not ready for production use!
Table of contents¶
- Introduction
- Quickstart
- Reference
- Contributing
- Faq
- Changelog
- Release 1.0 (Planned)
- Release 0.6 (Planned)
- Release 0.5 (Upcoming)
- Release 0.4.0 (Apr 27, 2016)
- Release 0.3.0 (Feb 23, 2016)
- Release 0.2.0 (Jan 23, 2016)
- Release 0.1.0 (Dec 29, 2015)
- Release 0.0.5 (Mar 21, 2015)
- Release 0.0.4 (Feb 24, 2015)
- Release 0.0.3 (Feb 17, 2015)
- Release 0.0.2 (Nov 9, 2014)
- Release 0.0.1 (Oct 10, 2014)