Reworked the directory structure, added start of test framework

This commit is contained in:
Johan B.W. de Vries 2025-02-02 14:25:16 +01:00
parent f798fbe55f
commit ad99832959
16 changed files with 399 additions and 256 deletions

4
0-lang0py/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/lang0py
/lang0py.c
/lang0py.exe
/lang0py.o

21
0-lang0py/Makefile Normal file
View File

@ -0,0 +1,21 @@
.SUFFIXES:
PYVERSION=3.10
PYPREFIX=/usr
INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION)
CYTHON=cython3
# No previous iteration to reference
all: lang0py.exe
%.exe: %.o
gcc -o $@ $< -lpython$(PYVERSION)
%.o: %.c
gcc -c $< $(INCLUDES)
%.c: %.py
$(CYTHON) -3 --embed $<
clean:
rm -f lang0py.c lang0py.o lang0py.exe

4
0-lang0py/lang0py.lang0 Normal file
View File

@ -0,0 +1,4 @@
; This file does not exit
; Iteration 0 is always writing a compiler in an existing environment
; Sometimes that means binary, sometimes that means assembly
; Luckily, for us this means we can use Python.

4
1-lang0py/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/lang0py*.c
/lang0py*.exe
/lang0py*.o
/lang0py*.py

36
1-lang0py/Makefile Normal file
View File

@ -0,0 +1,36 @@
.SUFFIXES:
PYVERSION=3.10
PYPREFIX=/usr
INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION)
CYTHON=cython3
LANG0PY=$(CURDIR)/../0-lang0py/lang0py.exe
all: lang0py.exe
%.exe: %.o
gcc -o $@ $< -lpython$(PYVERSION)
%.o: %.c
gcc -c $< $(INCLUDES)
%.c: %.py
$(CYTHON) -3 --embed $<
lang0py0.py: lang0py.lang0 $(LANG0PY)
cat $< | $(LANG0PY) > $@
lang0py1.py: lang0py.lang0 lang0py0.exe
cat $< | ./lang0py0.exe > $@
# Cannot diff on the first iteration - platform change
lang0py2.py: lang0py.lang0 lang0py1.exe
cat $< | ./lang0py1.exe > $@
-diff lang0py1.py lang0py2.py
lang0py.py: lang0py.lang0 lang0py2.exe
cat $< | ./lang0py2.exe > $@
-diff lang0py2.py lang0py.py
clean:
rm -f lang0py*.py lang0py*.c lang0py*.o lang0py*.exe

4
2-lang0c/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/lang0c*.c
/lang0c*.exe
/lang0c*.o
/lang0c*.py

42
2-lang0c/Makefile Normal file
View File

@ -0,0 +1,42 @@
.SUFFIXES:
PYVERSION=3.10
PYPREFIX=/usr
INCLUDES=
CYTHON=cython3
LANG0PY=$(CURDIR)/../1-lang0py/lang0py.exe
all: lang0c.exe
%.exe: %.o
gcc -o $@ $<
%.o: %.c
gcc -c $<
lang0c0.py: lang0c.lang0 $(LANG0PY)
cat $< | $(LANG0PY) > $@
lang0c0.c: lang0c0.py
$(CYTHON) -3 --embed $<
lang0c0.o: lang0c0.c
gcc -c $< -I$(PYPREFIX)/include/python$(PYVERSION)
lang0c0.exe: lang0c0.o
gcc -o $@ $< -lpython$(PYVERSION)
lang0c1.c: lang0c.lang0 lang0c0.exe
cat $< | ./lang0c0.exe > $@
# Cannot diff on the first iteration - platform change
lang0c2.c: lang0c.lang0 lang0c1.exe
cat $< | ./lang0c1.exe > $@
-diff lang0c1.c lang0c2.c
lang0c.c: lang0c.lang0 lang0c2.exe
cat $< | ./lang0c2.exe > $@
-diff lang0c2.c lang0c.c
clean:
rm -f lang0c*.py lang0c*.c lang0c*.o lang0c*.exe

View File

@ -1,69 +1,11 @@
.SUFFIXES:
GCC_FLAGS := -g -O0 -Wall
all: it2-out
# it0-out.py => Hand made
it1-out0.py: it0-out.py it1-in.lang0
cat it1-in.lang0 | python3 it0-out.py > it1-out0.py
it1-out1.py: it1-out0.py it1-in.lang0
cat it1-in.lang0 | python3 it1-out0.py > it1-out1.py
# We can diff here since the target hasn't changed
# The target for it0 is the same as for it1
diff it1-out0.py it1-out1.py
it1-out2.py: it1-out1.py it1-in.lang0
cat it1-in.lang0 | python3 it1-out1.py > it1-out2.py
diff it1-out1.py it1-out2.py
it1-out3.py: it1-out2.py it1-in.lang0
cat it1-in.lang0 | python3 it1-out2.py > it1-out3.py
diff it1-out2.py it1-out3.py
it1-out.py: it1-out3.py
cp it1-out3.py it1-out.py
it2-out0.py: it1-out.py it2-in.lang0
cat it2-in.lang0 | python3 it1-out.py > it2-out0.py
# No gcc step since the target is still python here
it2-out1.c: it2-out0.py it2-in.lang0
cat it2-in.lang0 | python3 it2-out0.py > it2-out1.c
# diff it2-out0.py it2-out1.py Do not diff - the target changed so the output will be different
it2-out1: it2-out1.c
gcc it2-out1.c -o it2-out1 $(GCC_FLAGS)
it2-out2.c: it2-out1 it2-in.lang0
cat it2-in.lang0 | ./it2-out1 > it2-out2.c
diff it2-out1.c it2-out2.c
it2-out2: it2-out2.c
gcc it2-out2.c -o it2-out2 $(GCC_FLAGS)
it2-out3.c: it2-out2 it2-in.lang0
cat it2-in.lang0 | ./it2-out2 > it2-out3.c
diff it2-out2.c it2-out3.c
it2-out3: it2-out3.c
gcc it2-out3.c -o it2-out3 $(GCC_FLAGS)
it2-out: it2-out3
cp it2-out3 it2-out
all:
$(MAKE) -C 0-lang0py all
$(MAKE) -C 1-lang0py all
$(MAKE) -C 2-lang0c all
$(MAKE) -C tests all
clean:
-rm it1-out* it2-out*
$(MAKE) -C 0-lang0py clean
$(MAKE) -C 1-lang0py clean
$(MAKE) -C 2-lang0c clean
$(MAKE) -C tests clean

View File

@ -9,7 +9,7 @@
"x": 725,
"y": 306,
"width": 197,
"height": 76,
"height": 60,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -25,8 +25,8 @@
"type": 3
},
"seed": 902003894,
"version": 28,
"versionNonce": 1349374006,
"version": 30,
"versionNonce": 882148575,
"isDeleted": false,
"boundElements": [
{
@ -34,16 +34,16 @@
"id": "vC6ze8D2C_8xamOti_FDo"
}
],
"updated": 1736684246699,
"updated": 1738501880052,
"link": null,
"locked": false
},
{
"id": "vC6ze8D2C_8xamOti_FDo",
"type": "text",
"x": 752.9500732421875,
"y": 319,
"width": 141.099853515625,
"x": 734.580078125,
"y": 311,
"width": 177.83984375,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -58,20 +58,20 @@
"index": "a0V",
"roundness": null,
"seed": 1788670826,
"version": 19,
"versionNonce": 1785814954,
"version": 31,
"versionNonce": 1178825919,
"isDeleted": false,
"boundElements": null,
"updated": 1736684250287,
"boundElements": [],
"updated": 1738501880052,
"link": null,
"locked": false,
"text": "it0-out.py\n(hand written)",
"text": "0-lang0py/lang0py\n(hand written)",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "sa5DlHhxpJaKEJJQyQzX0",
"originalText": "it0-out.py\n(hand written)",
"originalText": "0-lang0py/lang0py\n(hand written)",
"autoResize": true,
"lineHeight": 1.25
},
@ -133,7 +133,7 @@
"version": 68,
"versionNonce": 1195221302,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684348736,
"link": null,
"locked": false,
@ -205,7 +205,7 @@
"version": 482,
"versionNonce": 2052650218,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,
@ -277,7 +277,7 @@
"version": 115,
"versionNonce": 1274068970,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684445213,
"link": null,
"locked": false,
@ -349,7 +349,7 @@
"version": 179,
"versionNonce": 2088933354,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684949700,
"link": null,
"locked": false,
@ -421,7 +421,7 @@
"version": 219,
"versionNonce": 600803830,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684961559,
"link": null,
"locked": false,
@ -493,7 +493,7 @@
"version": 529,
"versionNonce": 1524384362,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,
@ -565,7 +565,7 @@
"version": 580,
"versionNonce": 973746154,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,
@ -637,7 +637,7 @@
"version": 628,
"versionNonce": 632995178,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,
@ -689,9 +689,9 @@
{
"id": "wbK8T0IJWC6QMWKFsflZU",
"type": "text",
"x": 593.9500732421875,
"x": 593.7700576782227,
"y": 135,
"width": 141.099853515625,
"width": 141.4598846435547,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -706,20 +706,20 @@
"index": "a0l",
"roundness": null,
"seed": 864846774,
"version": 138,
"versionNonce": 1358166378,
"version": 145,
"versionNonce": 1419718257,
"isDeleted": false,
"boundElements": null,
"updated": 1736684351221,
"boundElements": [],
"updated": 1738502492344,
"link": null,
"locked": false,
"text": "it1-in.lang0\n(hand written)",
"text": "1-lang0py/\nlang0py0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "JpWSt6KcCpoXnoEq_GCJp",
"originalText": "it1-in.lang0\n(hand written)",
"originalText": "1-lang0py/\nlang0py0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -761,9 +761,9 @@
{
"id": "Mj0dEWiGr1Z9qT8mn8V3K",
"type": "text",
"x": 1356.4500732421875,
"x": 1361.7000579833984,
"y": 132.5,
"width": 141.099853515625,
"width": 130.59988403320312,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -778,20 +778,20 @@
"index": "a0l2",
"roundness": null,
"seed": 779040554,
"version": 554,
"versionNonce": 365292266,
"version": 565,
"versionNonce": 874960209,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502506673,
"link": null,
"locked": false,
"text": "it2-in.lang0\n(hand written)",
"text": "2-lang0c/\nlang0c0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "xdt3-HzXEKTWxrWigJjiT",
"originalText": "it2-in.lang0\n(hand written)",
"originalText": "2-lang0c/\nlang0c0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -833,9 +833,9 @@
{
"id": "5pAueU5y4qXjdgix_f5pa",
"type": "text",
"x": 768.9500732421875,
"x": 768.7700576782227,
"y": -61,
"width": 141.099853515625,
"width": 141.4598846435547,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -850,20 +850,20 @@
"index": "a0l8",
"roundness": null,
"seed": 471340598,
"version": 242,
"versionNonce": 645687542,
"version": 243,
"versionNonce": 896719295,
"isDeleted": false,
"boundElements": null,
"updated": 1736684455955,
"boundElements": [],
"updated": 1738502495388,
"link": null,
"locked": false,
"text": "it1-in.lang0\n(hand written)",
"text": "1-lang0py/\nlang0py0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "Vi9eTOIjQtbNC7zF_5rwS",
"originalText": "it1-in.lang0\n(hand written)",
"originalText": "1-lang0py/\nlang0py0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -905,9 +905,9 @@
{
"id": "hOjP8z6dti8Z5hpgB3d5b",
"type": "text",
"x": 903.9500732421875,
"x": 903.7700576782227,
"y": -252.25,
"width": 141.099853515625,
"width": 141.4598846435547,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -922,20 +922,20 @@
"index": "a0l8G",
"roundness": null,
"seed": 1843097770,
"version": 308,
"versionNonce": 1508581622,
"version": 309,
"versionNonce": 1367318047,
"isDeleted": false,
"boundElements": null,
"updated": 1736684957255,
"boundElements": [],
"updated": 1738502496300,
"link": null,
"locked": false,
"text": "it1-in.lang0\n(hand written)",
"text": "1-lang0py/\nlang0py0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "nq35O_LXfbGnImWL9Qc06",
"originalText": "it1-in.lang0\n(hand written)",
"originalText": "1-lang0py/\nlang0py0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -977,9 +977,9 @@
{
"id": "P9GsVng_mlohB8reiaQaw",
"type": "text",
"x": 1042.7000732421875,
"x": 1042.5200576782227,
"y": -443.5,
"width": 141.099853515625,
"width": 141.4598846435547,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -994,20 +994,20 @@
"index": "a0l8O",
"roundness": null,
"seed": 1003079478,
"version": 348,
"versionNonce": 1453458550,
"version": 349,
"versionNonce": 63585919,
"isDeleted": false,
"boundElements": null,
"updated": 1736684961559,
"boundElements": [],
"updated": 1738502497243,
"link": null,
"locked": false,
"text": "it1-in.lang0\n(hand written)",
"text": "1-lang0py/\nlang0py0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "sm_C3kQH3NnoN8GY0WsHa",
"originalText": "it1-in.lang0\n(hand written)",
"originalText": "1-lang0py/\nlang0py0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -1049,9 +1049,9 @@
{
"id": "ypQvCIgox5Ez78rMw8nJk",
"type": "text",
"x": 1531.4500732421875,
"x": 1536.7000579833984,
"y": -62.5,
"width": 141.099853515625,
"width": 130.59988403320312,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -1066,20 +1066,20 @@
"index": "a0lC",
"roundness": null,
"seed": 1922220522,
"version": 659,
"versionNonce": 1812183146,
"version": 660,
"versionNonce": 1720655071,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502509525,
"link": null,
"locked": false,
"text": "it2-in.lang0\n(hand written)",
"text": "2-lang0c/\nlang0c0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "FkKqusUxwu0Fdxigv0fZW",
"originalText": "it2-in.lang0\n(hand written)",
"originalText": "2-lang0c/\nlang0c0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -1121,9 +1121,9 @@
{
"id": "5JR6I1qRvymfZUCUFUEiC",
"type": "text",
"x": 1693.4500732421875,
"x": 1698.7000579833984,
"y": -248.5,
"width": 141.099853515625,
"width": 130.59988403320312,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -1138,20 +1138,20 @@
"index": "a0lE",
"roundness": null,
"seed": 887058026,
"version": 720,
"versionNonce": 1951147498,
"version": 721,
"versionNonce": 1934701887,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502510388,
"link": null,
"locked": false,
"text": "it2-in.lang0\n(hand written)",
"text": "2-lang0c/\nlang0c0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "EIr70q6Ecsh_k_mhXX_d1",
"originalText": "it2-in.lang0\n(hand written)",
"originalText": "2-lang0c/\nlang0c0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -1193,9 +1193,9 @@
{
"id": "2mQPed9SFteJcR4z6zGyt",
"type": "text",
"x": 1803.4500732421875,
"x": 1808.7000579833984,
"y": -429.5,
"width": 141.099853515625,
"width": 130.59988403320312,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
@ -1210,20 +1210,20 @@
"index": "a0lF",
"roundness": null,
"seed": 1202851626,
"version": 768,
"versionNonce": 1685533546,
"version": 769,
"versionNonce": 1994500511,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502511204,
"link": null,
"locked": false,
"text": "it2-in.lang0\n(hand written)",
"text": "2-lang0c/\nlang0c0.lang0",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "P5YHIvfxndgZtpw2M194q",
"originalText": "it2-in.lang0\n(hand written)",
"originalText": "2-lang0c/\nlang0c0.lang0",
"autoResize": true,
"lineHeight": 1.25
},
@ -1233,7 +1233,7 @@
"x": 876,
"y": 121,
"width": 195.0000000000001,
"height": 74.99999999999999,
"height": 60,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1249,8 +1249,8 @@
"type": 3
},
"seed": 1738165110,
"version": 320,
"versionNonce": 242867434,
"version": 322,
"versionNonce": 348133425,
"isDeleted": false,
"boundElements": [
{
@ -1258,17 +1258,17 @@
"type": "text"
}
],
"updated": 1736684364282,
"updated": 1738501921397,
"link": null,
"locked": false
},
{
"id": "MFQOMZ3Q8GWnWIOy737f6",
"type": "text",
"x": 920.2900619506836,
"y": 146,
"width": 106.41987609863281,
"height": 25,
"x": 911.3100509643555,
"y": 126,
"width": 124.37989807128906,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1282,27 +1282,27 @@
"index": "a0t",
"roundness": null,
"seed": 781897450,
"version": 334,
"versionNonce": 1304604586,
"version": 341,
"versionNonce": 722253937,
"isDeleted": false,
"boundElements": null,
"updated": 1736684364282,
"boundElements": [],
"updated": 1738502436384,
"link": null,
"locked": false,
"text": "it1-out0.py",
"text": "1-lang0py/\nlang0py0.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "xhGx8DjmbBrbJtwOztMKw",
"originalText": "it1-out0.py",
"originalText": "1-lang0py/\nlang0py0.exe",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "V4SlwrmLxEj5lu0skBUJ1",
"type": "rectangle",
"x": 1638.5,
"x": 1636.8333333333335,
"y": 118.5,
"width": 195.0000000000001,
"height": 74.99999999999999,
@ -1321,8 +1321,8 @@
"type": 3
},
"seed": 1180838326,
"version": 735,
"versionNonce": 1456551466,
"version": 736,
"versionNonce": 183022687,
"isDeleted": false,
"boundElements": [
{
@ -1330,17 +1330,17 @@
"type": "text"
}
],
"updated": 1736684934138,
"updated": 1738502399176,
"link": null,
"locked": false
},
{
"id": "uq1n89eIzIoEF64MTNtC0",
"type": "text",
"x": 1680.0600662231445,
"y": 143.5,
"width": 111.87986755371094,
"height": 25,
"x": 1677.5733846028647,
"y": 131,
"width": 113.5198974609375,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1354,20 +1354,20 @@
"index": "a0tG",
"roundness": null,
"seed": 1735849130,
"version": 750,
"versionNonce": 1549590762,
"version": 769,
"versionNonce": 368020433,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502474072,
"link": null,
"locked": false,
"text": "it2-out0.py",
"text": "2-lang0c/\nlang0c0.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "V4SlwrmLxEj5lu0skBUJ1",
"originalText": "it2-out0.py",
"originalText": "2-lang0c/\nlang0c0.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1409,10 +1409,10 @@
{
"id": "Y8BLkvSVXeE_VCIsnaqRY",
"type": "text",
"x": 1055.2600555419922,
"y": -52.00000000000001,
"width": 102.47988891601562,
"height": 25,
"x": 1046.280044555664,
"y": -64.5,
"width": 120.43991088867188,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1426,20 +1426,20 @@
"index": "a0u",
"roundness": null,
"seed": 15431402,
"version": 394,
"versionNonce": 1445402998,
"version": 402,
"versionNonce": 624349585,
"isDeleted": false,
"boundElements": null,
"updated": 1736684465162,
"boundElements": [],
"updated": 1738502440183,
"link": null,
"locked": false,
"text": "it1-out1.py",
"text": "1-lang0py/\nlang0py1.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "q7GdmXdIkEVil1E7K3Vtv",
"originalText": "it1-out1.py",
"originalText": "1-lang0py/\nlang0py1.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1481,10 +1481,10 @@
{
"id": "nB2NHk0Nl6BGmmPd2LQlN",
"type": "text",
"x": 1187.5300598144531,
"y": -243.25,
"width": 107.93988037109375,
"height": 25,
"x": 1178.550048828125,
"y": -255.75,
"width": 125.89990234375,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1498,20 +1498,20 @@
"index": "a0u2",
"roundness": null,
"seed": 993774442,
"version": 460,
"versionNonce": 789420906,
"version": 466,
"versionNonce": 407639167,
"isDeleted": false,
"boundElements": null,
"updated": 1736684954094,
"boundElements": [],
"updated": 1738502442119,
"link": null,
"locked": false,
"text": "it1-out2.py",
"text": "1-lang0py/\nlang0py2.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "4tXC4CO1352XEGgn5ZWPo",
"originalText": "it1-out2.py",
"originalText": "1-lang0py/\nlang0py2.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1553,10 +1553,10 @@
{
"id": "K8FKdMdbEtQXcBMy_4JGQ",
"type": "text",
"x": 1327.2000579833984,
"y": -434.5,
"width": 106.09988403320312,
"height": 25,
"x": 1324.3000411987305,
"y": -447,
"width": 111.89991760253906,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1570,20 +1570,20 @@
"index": "a0u3",
"roundness": null,
"seed": 414675062,
"version": 502,
"versionNonce": 1109378358,
"version": 507,
"versionNonce": 47527537,
"isDeleted": false,
"boundElements": null,
"updated": 1736684963415,
"boundElements": [],
"updated": 1738502444576,
"link": null,
"locked": false,
"text": "it1-out3.py",
"text": "1-lang0py/\nlang0py.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "_njzXhKgPzadFQfgDnI_E",
"originalText": "it1-out3.py",
"originalText": "1-lang0py/\nlang0py.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1625,10 +1625,10 @@
{
"id": "-3hZTUkUzcwcd4qQ6tH9Q",
"type": "text",
"x": 1533.4500579833984,
"y": 324.25,
"width": 106.09988403320312,
"height": 25,
"x": 1530.5500411987305,
"y": 311.75,
"width": 111.89991760253906,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1642,20 +1642,20 @@
"index": "a0u8",
"roundness": null,
"seed": 1942100970,
"version": 523,
"versionNonce": 1708469866,
"version": 527,
"versionNonce": 1763250065,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502452896,
"link": null,
"locked": false,
"text": "it1-out3.py",
"text": "1-lang0py/\nlang0py.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "ZjoMA7OeaNnjNpaVjFLsc",
"originalText": "it1-out3.py",
"originalText": "1-lang0py/\nlang0py.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1697,10 +1697,10 @@
{
"id": "gSS5ui-65NHgMOUQh5qaI",
"type": "text",
"x": 1820.8600616455078,
"y": -54.5,
"width": 96.27987670898438,
"height": 25,
"x": 1814.2100448608398,
"y": -67,
"width": 109.57991027832031,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1714,20 +1714,20 @@
"index": "a0uV",
"roundness": null,
"seed": 2126958442,
"version": 761,
"versionNonce": 1958222826,
"version": 771,
"versionNonce": 1871453791,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502478104,
"link": null,
"locked": false,
"text": "it2-out1.c",
"text": "2-lang0c/\nlang0c1.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "_dSfxbsy4dHEcZZ5zwehT",
"originalText": "it2-out1.c",
"originalText": "2-lang0c/\nlang0c1.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1769,10 +1769,10 @@
{
"id": "0RfiY6ME4YQvG93V4ZTf7",
"type": "text",
"x": 1922.1300659179688,
"y": -233.5,
"width": 101.7398681640625,
"height": 25,
"x": 1915.4800491333008,
"y": -246,
"width": 115.03990173339844,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1786,20 +1786,20 @@
"index": "a0uZ",
"roundness": null,
"seed": 1038423094,
"version": 823,
"versionNonce": 1725802858,
"version": 832,
"versionNonce": 606612113,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502480152,
"link": null,
"locked": false,
"text": "it2-out2.c",
"text": "2-lang0c/\nlang0c2.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "7AT_y3BQx_MTOK2YJ5gyT",
"originalText": "it2-out2.c",
"originalText": "2-lang0c/\nlang0c2.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1841,10 +1841,10 @@
{
"id": "yJu3JDSgZH2EElzwcEo8a",
"type": "text",
"x": 2038.050064086914,
"y": -418.5,
"width": 99.89987182617188,
"height": 25,
"x": 2037.4800415039062,
"y": -431,
"width": 101.0399169921875,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
@ -1858,20 +1858,20 @@
"index": "a0ub",
"roundness": null,
"seed": 1154290486,
"version": 865,
"versionNonce": 69064426,
"version": 868,
"versionNonce": 1145930655,
"isDeleted": false,
"boundElements": null,
"updated": 1736684934138,
"boundElements": [],
"updated": 1738502483040,
"link": null,
"locked": false,
"text": "it2-out3.c",
"text": "2-lang0c/\nlang0c.exe",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "wtdGNdh8BUiQz-JxcpA_L",
"originalText": "it2-out3.c",
"originalText": "2-lang0c/\nlang0c.exe",
"autoResize": true,
"lineHeight": 1.25
},
@ -1900,7 +1900,7 @@
"version": 59,
"versionNonce": 2125545782,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684495257,
"link": null,
"locked": false,
@ -1946,7 +1946,7 @@
"version": 124,
"versionNonce": 1720455530,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684957255,
"link": null,
"locked": false,
@ -1992,7 +1992,7 @@
"version": 163,
"versionNonce": 1556910134,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684961559,
"link": null,
"locked": false,
@ -2038,7 +2038,7 @@
"version": 472,
"versionNonce": 550988202,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,
@ -2084,7 +2084,7 @@
"version": 532,
"versionNonce": 2119214186,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,
@ -2130,7 +2130,7 @@
"version": 579,
"versionNonce": 911509290,
"isDeleted": false,
"boundElements": null,
"boundElements": [],
"updated": 1736684934138,
"link": null,
"locked": false,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 143 KiB

12
tests/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
/*.it0
/*.it0.c
/*.it0.o
/*.it0.py
/*.it1
/*.it1.c
/*.it1.o
/*.it1.py
/*.it2
/*.it2.c
/*.it2.o
/*.results

71
tests/Makefile Normal file
View File

@ -0,0 +1,71 @@
.SUFFIXES:
.PHONY: all clean
PYVERSION=3.10
PYPREFIX=/usr
CYTHON=cython3
CC=gcc
TESTLIST=$(shell ls *.lang0 | sed 's/.lang0//')
all: all-it0.results all-it1.results all-it2.results
all-it0.results: $(addsuffix .it0, $(TESTLIST))
-rm -f $@
$(foreach test,$(TESTLIST), echo -n "$(test) " >> $@; ./$(test).it0 >> $@ ; echo "" >> $@)
! grep -v 'Success' $@
all-it1.results: $(addsuffix .it1, $(TESTLIST))
-rm -f $@
$(foreach test,$(TESTLIST), echo -n "$(test) " >> $@; ./$(test).it1 >> $@ ; echo "" >> $@)
! grep -v 'Success' $@
all-it2.results: $(addsuffix .it2, $(TESTLIST))
-rm -f $@
$(foreach test,$(TESTLIST), echo -n "$(test) " >> $@; ./$(test).it2 >> $@ ; echo "" >> $@)
! grep -v 'Success' $@
clean:
-rm -f *.result *.it0* *.it1* *.it2*
###
# it0
%.it0.py: %.lang0 ../0-lang0py/lang0py.exe
cat $< | ../0-lang0py/lang0py.exe > $@
%.it0.c: %.it0.py
$(CYTHON) -3 --embed -o $@ $^
%.it0.o: %.it0.c
$(CC) -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
%.it0: %.it0.o
$(CC) -o $@ $^ -lpython$(PYVERSION)
###
# it1
%.it1.py: %.lang0 ../1-lang0py/lang0py.exe
cat $< | ../1-lang0py/lang0py.exe > $@
%.it1.c: %.it1.py
$(CYTHON) -3 --embed -o $@ $^
%.it1.o: %.it1.c
$(CC) -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
%.it1: %.it1.o
$(CC) -o $@ $^ -lpython$(PYVERSION)
###
# it2
%.it2.c: %.lang0 ../2-lang0c/lang0c.exe
cat $< | ../2-lang0c/lang0c.exe > $@
%.it2.o: %.it2.c
$(CC) -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
%.it2: %.it2.o
$(CC) -o $@ $^ -lpython$(PYVERSION)

3
tests/emit.lang0 Normal file
View File

@ -0,0 +1,3 @@
main:
emit "Success"
/