compilation added

This commit is contained in:
Nicolas Kruse 2025-09-26 23:25:51 +02:00
parent 306f86d977
commit 4d5777304f
4 changed files with 26 additions and 2 deletions

View File

@ -19,6 +19,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Setup cross compilers
run: sudo apt-get update && sudo apt-get install -y mingw-w64
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
@ -32,6 +35,12 @@ jobs:
- name: Build ops obj file
run: bash build_ops_obj.sh
- name: Build runner
run: |
mkdir runner/bin
gcc runner/runmem2.c -Wall -O2 -o runner/bin/runmem2
x86_64-w64-mingw32-gcc runner/runmem2.c -Wall -O2 -o runner/bin/runmem2.exe
#- name: Lint code with flake8
# run: flake8
@ -46,4 +55,10 @@ jobs:
if: strategy.job-index == 0
with:
name: object files
path: src/copapy/obj/*.o
path: src/copapy/obj/*.o
- name: Upload compiled runner
uses: actions/upload-artifact@v4
with:
name: runner
path: runner/bin/*

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ __pycache__
tests/autogenerated_*.py
*test*.o
/src/copapy/obj/ops*.o
test.copapy

View File

@ -369,6 +369,11 @@ def compile_to_instruction_list(end_nodes: Iterable[Node] | Node) -> binw.data_w
dw.write_int(patch_type)
dw.write_int(object_addr)
print('-----')
# set entry point
dw.write_com(binw.Command.SET_ENTR_POINT)
dw.write_int(0)
# run program command
dw.write_com(binw.Command.END_PROG)
return dw

View File

@ -1,6 +1,7 @@
from copapy import Write, const
import copapy as rc
def test_compile():
c1 = const(1.11)
c2 = const(2.22)
@ -17,6 +18,8 @@ def test_compile():
print('#', il.print())
il.to_file('test.copapy')
if __name__ == "__main__":
test_compile()