Tracing based copy-and-patch compiler for Python
Go to file
Nicolas e8bf9f1a26 read_value function added to read result variable values 2025-10-03 23:26:51 +02:00
.github/workflows ci fexed 2 2025-09-30 23:19:44 +02:00
src read_value function added to read result variable values 2025-10-03 23:26:51 +02:00
tests read_value function added to read result variable values 2025-10-03 23:26:51 +02:00
.flake8 code cleaned up, passes flake8 and mypy 2025-10-01 23:09:49 +02:00
.gitignore python module is working. no return values yet. 2025-10-03 23:09:25 +02:00
LICENSE readme and license updated 2025-09-29 23:11:54 +02:00
README.md readme and license updated 2025-09-29 23:11:54 +02:00
build.sh python module is working. no return values yet. 2025-10-03 23:09:25 +02:00
pyproject.toml python module is working. no return values yet. 2025-10-03 23:09:25 +02:00
setup.py python module is working. no return values yet. 2025-10-03 23:09:25 +02:00
test.sh python c model skeleton added 2025-10-03 22:49:07 +02:00

README.md

State of the project

Development is in a very early stage. Only very few components are in a working state.

Introduction

Copapy is a copy and patch based compiler. It compiles a python based language to machine code. The language can be considered as an embedded language. It uses the python interpreter for generating a directed graph of variables and operations. The compiler generates machine code by composing pre-compiled stencils derived from C code with gcc -O3.

For code execution a runner executable receives the composed machine code, data and patch instructions. The patch instructions are used to correct memory address offsets.

The Project targets applications that profit from fast implementation (e.g. prototyping) and require realtime with low latency as well as minimizing risk of implementation errors reaching runtime. This applies primarily for applications interfacing hardware, where runtime errors might lead to physical damage.

The project aims to be:

  • Type save
  • Having turing completeness only during compile time
  • Predictable runtime
  • No software runtime errors
  • Immutable types

Structure

Compilation

The Compilation step starts with the directed graph of variables and operations generated by the python interpreter.

Tooling

Because the language is an embedded language, it can relay heavily on python tooling. While copapy is static typed, it uses Python to derive types during compile time wherever possible. It can get full benefit from python type checkers, to catch type errors even before compilation. Python and Copapy code can be combined seamlessly. Python acts as macro-language for the Copapy program. However, the project is designed in a way that the distinction has typically not to be considered by the programmer.

License

This project is licensed under the MIT License - see the LICENSE file for details.