Compare commits

..

1 Commits

Author SHA1 Message Date
Johan B.W. de Vries
c54a158d78 Start on llvm IR target 2025-02-01 17:54:02 +01:00
48 changed files with 592 additions and 1535 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/it0-out0.diff /it0-out0.diff
/it1-out* /it1-out*
/it2-out* /it2-out*
/it3-out*

View File

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

View File

@ -1,21 +0,0 @@
.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

View File

@ -1,4 +0,0 @@
; 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.

View File

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

View File

@ -1,36 +0,0 @@
.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
View File

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

View File

@ -1,42 +0,0 @@
.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,4 +0,0 @@
/lang0c*.c
/lang0c*.exe
/lang0c*.ll
/lang0c*.o

View File

@ -1,42 +0,0 @@
.SUFFIXES:
LANG0C=$(CURDIR)/../2-lang0c/lang0c.exe
all: lang0ll.exe
%.exe: %.s
clang $^ -o $@
%.s: %.ll
llc --relocation-model=pic $^
lang0ll0.c: lang0ll.lang0 $(LANG0C)
cat $< | $(LANG0C) > $@
lang0ll0.o: lang0ll0.c
gcc -c $<
lang0ll0.exe: lang0ll0.o
gcc -o $@ $<
lang0ll1.ll: lang0ll.lang0 lang0ll0.exe
cat $< | ./lang0ll0.exe > $@
# Cannot diff on the first iteration - platform change
lang0ll2.ll: lang0ll.lang0 lang0ll1.exe
cat $< | ./lang0ll1.exe > $@
-diff lang0ll1.ll lang0ll2.ll
lang0ll.ll: lang0ll.lang0 lang0ll2.exe
cat $< | ./lang0ll2.exe > $@
-diff lang0ll2.ll lang0ll.ll
foo.ll: foo.c
clang -S -emit-llvm $^
clean:
rm -f lang0ll*.py lang0ll*.ll lang0ll*.o lang0ll*.exe foo.ll foo.o foo.exe

Binary file not shown.

View File

@ -1,49 +0,0 @@
; ModuleID = 'foo.c'
source_filename = "foo.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [14 x i8] c"Hello, world!\00", align 1
@.str.1 = private unnamed_addr constant [16 x i8] c"This is a test.\00", align 1
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @print(i8* noundef %0) #0 {
%2 = alloca i8*, align 8
store i8* %0, i8** %2, align 8
ret void
}
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @sum(i32 noundef %0, i32 noundef %1) #0 {
%3 = alloca i32, align 4
%4 = alloca i32, align 4
store i32 %0, i32* %3, align 4
store i32 %1, i32* %4, align 4
%5 = load i32, i32* %3, align 4
%6 = load i32, i32* %4, align 4
%7 = add nsw i32 %5, %6
ret i32 %7
}
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
%2 = alloca i8*, align 8
store i32 0, i32* %1, align 4
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2, align 8
call void @print(i8* noundef getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @sum(i32 noundef 7, i32 noundef 15)
ret i32 %3
}
attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 1}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"Ubuntu clang version 14.0.0-1ubuntu1.1"}

View File

@ -1,608 +0,0 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char var_eof[2] = {-1, 0};
char var_eol[2] = {10, 0};
char var_quote[2] = {34, 0};
char var_false[1] = {0};
char var_true[2] = {'1', 0};
char * eq(char * a, char * b)
{
return (strcmp(a, b) == 0) ? var_true : var_false;
}
char * lt(char * a, char * b)
{
return (strcmp(a, b) < 0) ? var_true : var_false;
}
char * not(char * a)
{
return (strcmp(a, var_true) != 0) ? var_true : var_false;
}
char * addstringchar(char * str, char * chr)
{
int str_len = strlen(str);
assert(strlen(chr) == 1);
char * res = malloc((str_len + 2) * sizeof(char));
strcpy(res, str);
res[str_len + 0] = chr[0];
res[str_len + 1] = 0;
return res;
}
char * emit(char * str)
{
fputs(str, stdout);
return 0;
}
char * trace(char * var_name, char * var_value)
{
const char * env_trace = getenv("TRACE");
if( !env_trace ) return 0;
fputs(var_name, stderr);
fputs("=", stderr);
fputs(var_value, stderr);
fputs(var_eol, stderr);
return 0;
}
int LINE = 1;
char * peek()
{
char * res = malloc(2*sizeof(char));
res[0] = getc(stdin);
res[1] = 0;
ungetc(res[0], stdin);
return res;
}
void skip()
{
char c = getc(stdin);
if( c == 10 ) LINE += 1;
}
void skipchar(char * chr)
{
assert(strlen(chr) == 1);
char * act = peek();
assert(strlen(act) == 1);
if( chr[0] == act[0] ) {skip(); return;};
fprintf(stderr, "Expected '%c' on line %d but saw '%c' instead%c", chr[0], LINE, act[0], 10);
exit(1);
}
char * increaseindent(char * var_indent)
{
var_indent = addstringchar(var_indent, " ");
var_indent = addstringchar(var_indent, " ");
var_indent = addstringchar(var_indent, " ");
var_indent = addstringchar(var_indent, " ");
return var_indent;
}
char * lexident()
{
char * var_char;
char * var_isbeforea;
char * var_isafterz;
char * var_word;
var_word = "";
while (1)
{
var_char = peek();
var_isbeforea = lt(var_char, "a");
if ( 0 < strlen(var_isbeforea) )
{
break;
}
var_isafterz = lt("z", var_char);
if ( 0 < strlen(var_isafterz) )
{
break;
}
var_word = addstringchar(var_word, var_char);
skip();
}
return var_word;
}
char * parseconststring()
{
char * var_char;
char * var_iseof;
char * var_isquote;
skipchar(var_quote);
while (1)
{
var_char = peek();
var_iseof = eq(var_char, var_eof);
if ( 0 < strlen(var_iseof) )
{
break;
}
var_isquote = eq(var_char, var_quote);
if ( 0 < strlen(var_isquote) )
{
break;
}
skip();
}
skipchar(var_quote);
emit("i8* noundef getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)");
return 0;
}
char * parseexprvarref()
{
char * var_varname;
var_varname = lexident();
emit("i8* %");
emit(var_varname);
return 0;
}
char * parseexprcall()
{
char * var_char;
char * var_first;
char * var_funcname;
char * var_isspace;
char * var_isnotspace;
char * var_isfirst;
char * var_isnotfirst;
char * var_isquote;
char * var_isnotquote;
var_funcname = lexident();
emit(var_funcname);
emit("(");
var_first = "1";
while (1)
{
var_char = peek();
var_isspace = eq(var_char, " ");
var_isnotspace = not(var_isspace);
if ( 0 < strlen(var_isnotspace) )
{
break;
}
skip();
var_isfirst = eq(var_first, "1");
var_isnotfirst = not(var_isfirst);
if ( 0 < strlen(var_isnotfirst) )
{
emit(", ");
}
var_char = peek();
var_isquote = eq(var_char, var_quote);
var_isnotquote = not(var_isquote);
if ( 0 < strlen(var_isquote) )
{
parseconststring();
}
if ( 0 < strlen(var_isnotquote) )
{
parseexprvarref();
}
var_first = "0";
}
emit(")");
return 0;
}
char * parsestatdeclare(char * var_indent)
{
char * var_var;
skipchar(" ");
var_var = lexident();
emit(var_indent);
emit("char * var_");
emit(var_var);
emit(";");
emit(var_eol);
skipchar(var_eol);
return 0;
}
char * parsestatset(char * var_indent)
{
char * var_var;
skipchar(" ");
var_var = lexident();
skipchar(" ");
emit(var_indent);
emit("var_");
emit(var_var);
emit(" = ");
parseconststring();
emit(";");
emit(var_eol);
skipchar(var_eol);
return 0;
}
char * parsestatcalc(char * var_indent)
{
char * var_var;
char * var_varidx;
skipchar(" ");
var_var = lexident();
skipchar(" ");
emit(var_indent);
emit("%");
emit(var_var);
var_varidx = mapgetkey("funcvarused", var_var);
var_varidx = intinc(var_varidx);
mapsetkey("funcvarused"var_var, var_varidx, );
emit(".");
emit(var_varidx);
emit(" = call i8* @");
parseexprcall();
emit(";");
emit(var_eol);
skipchar(var_eol);
return 0;
}
char * parseblock(char * var_indent);
char * parsestatif(char * var_indent)
{
char * var_indentt;
skipchar(" ");
emit(var_indent);
emit("if ( 0 < strlen(");
parseexprvarref();
emit(") )\n");
emit(var_indent);
emit("{\n");
skipchar(var_eol);
var_indentt = increaseindent(var_indent);
parseblock(var_indentt);
emit(var_indent);
emit("}\n");
return 0;
}
char * parsestatforever(char * var_indent)
{
char * var_indentt;
emit(var_indent);
emit("while (1)\n");
emit(var_indent);
emit("{\n");
skipchar(var_eol);
var_indentt = increaseindent(var_indent);
parseblock(var_indentt);
emit(var_indent);
emit("}\n");
return 0;
}
char * parsestatbreak(char * var_indent)
{
emit(var_indent);
emit("break;\n");
skipchar(var_eol);
return 0;
}
char * parsestatreturn(char * var_indent)
{
char * var_char;
char * var_isspace;
char * var_isnotspace;
emit(var_indent);
emit("ret ");
var_char = peek();
var_isspace = eq(var_char, " ");
var_isnotspace = not(var_isspace);
if ( 0 < strlen(var_isspace) )
{
skip();
parseexprvarref();
}
if ( 0 < strlen(var_isnotspace) )
{
emit("i18* 0");
}
emit(";");
emit(var_eol);
skipchar(var_eol);
return 0;
}
char * parsestattrace(char * var_indent)
{
char * var_varname;
emit(var_indent);
emit("trace(");
emit(var_quote);
skipchar(" ");
var_varname = lexident();
emit(var_varname);
emit(var_quote);
emit(", var_");
emit(var_varname);
emit(");\n");
skipchar(var_eol);
return 0;
}
char * parsestat(char * var_indent)
{
char * var_call;
char * var_char;
char * var_first;
char * var_iscall;
char * var_isfirst;
char * var_isspace;
char * var_isquote;
char * var_isnotfirst;
char * var_isnotspace;
char * var_isnotquote;
var_call = lexident();
trace("call", var_call);
var_iscall = eq(var_call, "declare");
if ( 0 < strlen(var_iscall) )
{
parsestatdeclare(var_indent);
return 0;
}
var_iscall = eq(var_call, "set");
if ( 0 < strlen(var_iscall) )
{
parsestatset(var_indent);
return 0;
}
var_iscall = eq(var_call, "calc");
if ( 0 < strlen(var_iscall) )
{
parsestatcalc(var_indent);
return 0;
}
var_iscall = eq(var_call, "if");
if ( 0 < strlen(var_iscall) )
{
parsestatif(var_indent);
return 0;
}
var_iscall = eq(var_call, "forever");
if ( 0 < strlen(var_iscall) )
{
parsestatforever(var_indent);
return 0;
}
var_iscall = eq(var_call, "break");
if ( 0 < strlen(var_iscall) )
{
parsestatbreak(var_indent);
return 0;
}
var_iscall = eq(var_call, "return");
if ( 0 < strlen(var_iscall) )
{
parsestatreturn(var_indent);
return 0;
}
var_iscall = eq(var_call, "trace");
if ( 0 < strlen(var_iscall) )
{
parsestattrace(var_indent);
return 0;
}
emit(var_indent);
emit(var_call);
emit("(");
var_first = "1";
while (1)
{
var_char = peek();
var_isspace = eq(var_char, " ");
var_isnotspace = not(var_isspace);
if ( 0 < strlen(var_isnotspace) )
{
break;
}
skip();
var_char = peek();
var_isquote = eq(var_char, var_quote);
var_isnotquote = not(var_isquote);
if ( 0 < strlen(var_isquote) )
{
parseconststring();
}
if ( 0 < strlen(var_isnotquote) )
{
parseexprvarref();
}
var_isfirst = eq(var_first, "1");
var_isnotfirst = not(var_isfirst);
if ( 0 < strlen(var_isnotfirst) )
{
emit(", ");
}
var_first = "0";
}
skipchar(var_eol);
emit(");\n");
return 0;
}
char * parseblock(char * var_indent)
{
char * var_char;
char * var_copy;
char * var_iseol;
char * var_isnoteol;
char * var_isdone;
char * var_iseoblock;
while (1)
{
while (1)
{
var_char = peek();
var_iseol = eq(var_char, var_eol);
var_isnoteol = not(var_iseol);
if ( 0 < strlen(var_isnoteol) )
{
break;
}
skip();
}
var_copy = " ";
while (1)
{
var_isdone = eq(var_copy, var_indent);
if ( 0 < strlen(var_isdone) )
{
break;
}
skipchar("\t");
var_copy = increaseindent(var_copy);
}
var_char = peek();
var_iseoblock = eq(var_char, "/");
if ( 0 < strlen(var_iseoblock) )
{
skip();
skipchar(var_eol);
break;
}
skipchar("\t");
parsestat(var_indent);
}
return 0;
}
char * parsefunc()
{
char * var_char;
char * var_first;
char * var_funcname;
char * var_iseoblock;
char * var_isfirst;
char * var_isspace;
char * var_isnotfirst;
char * var_isnotspace;
char * var_var;
mapclear("funcvarused");
var_funcname = lexident();
trace("funcname", var_funcname);
emit("define i8* @");
emit(var_funcname);
emit("(");
var_first = "1";
while (1)
{
var_char = peek();
var_isspace = eq(var_char, " ");
var_isnotspace = not(var_isspace);
if ( 0 < strlen(var_isnotspace) )
{
break;
}
skip();
var_var = lexident();
var_isfirst = eq(var_first, "1");
var_isnotfirst = not(var_isfirst);
if ( 0 < strlen(var_isnotfirst) )
{
emit(", ");
}
emit("i8* %");
emit(var_var);
mapsetkey("funcvarused""var", "0", );
emit("_0");
var_first = "0";
}
var_char = peek();
var_iseoblock = eq(var_char, "/");
if ( 0 < strlen(var_iseoblock) )
{
skipchar("/");
skipchar(var_eol);
emit(");");
emit("\n");
return 0;
}
skipchar(":");
skipchar(var_eol);
emit(")\n{\n");
parseblock(" ");
emit("}\n\n");
return 0;
}
char * emitheader()
{
emit("target datalayout = ");
emit(var_quote);
emit("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128");
emit(var_quote);
emit(var_eol);
emit("target triple = ");
emit(var_quote);
emit("x86_64-pc-linux-gnu");
emit(var_quote);
emit(var_eol);
emit(var_eol);
emit("define i8* @addstringchar(i8* %0, i8* %1)");
emit(var_eol);
emit("{");
emit(var_eol);
emit(" ; todo");
emit(var_eol);
emit(" ret i8* %0;");
emit(var_eol);
emit("}");
emit(var_eol);
emit(var_eol);
return 0;
}
char * emitfooter()
{
emit("");
return 0;
}
char * main()
{
char * var_char;
char * var_iseof;
char * var_iseol;
char * var_isnoteol;
emitheader();
while (1)
{
var_char = peek();
var_iseof = eq(var_char, var_eof);
if ( 0 < strlen(var_iseof) )
{
break;
}
while (1)
{
var_char = peek();
var_iseol = eq(var_char, var_eol);
var_isnoteol = not(var_iseol);
if ( 0 < strlen(var_isnoteol) )
{
break;
}
skip();
}
parsefunc();
}
emitfooter();
return 0;
}

100
Makefile
View File

@ -1,11 +1,93 @@
all: .SUFFIXES:
$(MAKE) -C 0-lang0py all
$(MAKE) -C 1-lang0py all GCC_FLAGS := -g -O0 -Wall
$(MAKE) -C 2-lang0c all
$(MAKE) -C tests all
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 > $@
# 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 $^ -o $@ $(GCC_FLAGS)
it2-out2.c: it2-out1 it2-in.lang0
cat it2-in.lang0 | ./it2-out1 > $@
diff it2-out1.c $@
it2-out2: it2-out2.c
gcc $^ -o $@ $(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 $^ -o $@ $(GCC_FLAGS)
it2-out: it2-out3
cp it2-out3 it2-out
it3-out0.c: it2-out it3-in.lang0
cat it3-in.lang0 | ./it2-out > it3-out0.c
# gcc step since the target is still python here
it3-out0: it3-out0.c
gcc $^ -o $@ $(GCC_FLAGS)
it3-out1.ll: it3-out0 it3-in.lang0
cat it3-in.lang0 | ./it3-out0 > $@
it3-out1.s: it3-out1.ll
llc $^ -o $@
foo.ll: foo.c
clang -S -emit-llvm $^
foo.s: foo.ll
llc $^
foo: foo.s
clang $^ -o $@
clean: clean:
$(MAKE) -C 0-lang0py clean -rm it1-out* it2-out*
$(MAKE) -C 1-lang0py clean
$(MAKE) -C 2-lang0c clean
$(MAKE) -C tests clean

View File

@ -49,32 +49,6 @@ Indentation is done using tabs.
### Parsing ### Parsing
#### Pre declaration (functions)
Functions need to be pre-declared if you intend to use them before you have defined them:
```
func result/
...
func result:
return result
/
```
#### Pre declaration (variables)
Variables will need to be declared before you can use them:
```
func:
declare result
set result "Result"
return result
/
```
### Variables ### Variables
#### calc var func args* #### calc var func args*
@ -95,10 +69,6 @@ Sets var to "const".
Exits the deepest `forever` loop. Exits the deepest `forever` loop.
#### func args*
Calls the function name `func` with the given arguments. The result, if any, is ignored.
#### if arg #### if arg
Evaluates arg. If found to be true, descends in the block. Otherwise, skips the block Evaluates arg. If found to be true, descends in the block. Otherwise, skips the block
@ -111,13 +81,27 @@ Repeats the block until `break` or `return` is called.
Returns the given value. You can not give an argument if your function is never used in `call`. Returns the given value. You can not give an argument if your function is never used in `call`.
#### func args*
Calls the given function with the given arguments. The result, if any, is ignored.
### Builtins ### Builtins
#### trace #### trace
Writes the name and value of the variable passed to stderr if the TRACE environment variable is set. Writes the name and value of the variable passed to stderr if the TRACE environment variable is set.
### Standard library functions #### Standard library functions
#### eq a b
Return true if the given strings are the same.
#### lt a b
`a` and `b` are expected to have length 1.
Return true if a would sort before b.
#### addstringchar a b #### addstringchar a b
@ -129,9 +113,9 @@ Creates a new string with `b` appended to `a`.
Writes the given string to standard output. Writes the given string to standard output.
#### eq a b #### fileget path
Return true if the given strings are the same. Reads a file named `path` from the current directory into a string.
#### intinc a #### intinc a
@ -140,12 +124,6 @@ Available in it2 runtime and onwards.
Interprets string `a` as an integer, increases it by one and returns it (as a string). Interprets string `a` as an integer, increases it by one and returns it (as a string).
If `a` cannot be interpreted as an integer, or has additional bytes, this function returns 1. If `a` cannot be interpreted as an integer, or has additional bytes, this function returns 1.
#### lt a b
`a` and `b` are expected to have length 1.
Return true if a would sort before b.
#### mapclear mapname #### mapclear mapname
Available in it2 runtime and onwards. Available in it2 runtime and onwards.

2
it0-in-footer.py Normal file
View File

@ -0,0 +1,2 @@
if __name__ == '__main__':
main()

51
it0-in-header.py Normal file
View File

@ -0,0 +1,51 @@
import os
import sys
def eq(a, b):
return a == b
def lt(a, b):
return a[0] < b[0]
def addstringchar(a, b):
return a + b[0]
def emit(string):
sys.stdout.write(string)
def trace(header, value):
if os.environ.get('TRACE'):
sys.stderr.write(f'{header}={value!r}\\n')
eof = chr(0)
eol = chr(10)
quote = chr(34)
PEEK = None
LINE = 1
def peek():
global PEEK
if PEEK is None:
char = sys.stdin.read(1)
trace('char', char)
if not char:
PEEK = eof
else:
PEEK = char
return PEEK
def skip():
global LINE
global PEEK
if eol == PEEK:
LINE += 1
PEEK = None
def skipchar(char):
global LINE
assert char == peek(), (LINE, char, peek())
skip()
def fileget(path):
with open(f'./{path}', encoding='ASCII') as fil:
return fil.read()

View File

@ -27,8 +27,6 @@ def peek():
return PEEK return PEEK
peek()
def skip(): def skip():
global LINE global LINE
global PEEK global PEEK
@ -43,9 +41,9 @@ def skipchar(char):
assert char == peek(), (LINE, char, peek()) assert char == peek(), (LINE, char, peek())
skip() skip()
def emitln(data): def fileget(path):
emit(data) with open(f'./{path}', encoding='ASCII') as fil:
emit(eol) return fil.read()
def lexident(): def lexident():
word = '' word = ''
@ -139,21 +137,21 @@ def parsestatif(indent):
emit(' ' * indent) emit(' ' * indent)
emit('if ') emit('if ')
parseexprvarref() parseexprvarref()
emitln(':') emit(':\n')
skipchar(eol) skipchar(eol)
parseblock(indent + 1) parseblock(indent + 1)
def parsestatforever(indent): def parsestatforever(indent):
emit(' ' * indent) emit(' ' * indent)
emitln('while True:') emit('while True:\n')
skipchar(eol) skipchar(eol)
parseblock(indent + 1) parseblock(indent + 1)
def parsestatbreak(indent): def parsestatbreak(indent):
emit(' ' * indent) emit(' ' * indent)
emitln('break') emit('break\n')
skipchar(eol) skipchar(eol)
def parsestatreturn(indent): def parsestatreturn(indent):
@ -176,7 +174,7 @@ def parsestattrace(indent):
emit(var_name) emit(var_name)
emit('", ') emit('", ')
emit(var_name) emit(var_name)
emitln(')') emit(')\n')
def parsestat(indent): def parsestat(indent):
call = lexident() call = lexident()
@ -231,7 +229,7 @@ def parsestat(indent):
skipchar(eol) skipchar(eol)
emitln(')') emit(')\n')
def parseblock(indent): def parseblock(indent):
while True: while True:
@ -271,75 +269,27 @@ def parsefunc():
# Ahead declaration # Ahead declaration
skipchar('/') skipchar('/')
skipchar(eol) skipchar(eol)
emitln("):") emit("):\n")
emitln(" pass # ahead declaration") emit(" pass # ahead declaration\n")
emit(eol) emit("\n")
return return
skipchar(':') skipchar(':')
skipchar(eol) skipchar(eol)
emitln('):') emit('):\n')
parseblock(1) parseblock(1)
emit(eol) emit("\n")
def emitheader(): def emitheader():
emitln("import os") header = fileget("it0-in-header.py")
emitln("import sys") emit(header)
emitln("")
emitln("def eq(a, b):")
emitln(" return a == b")
emitln("")
emitln("def lt(a, b):")
emitln(" return a[0] < b[0]")
emitln("")
emitln("def addstringchar(a, b):")
emitln(" return a + b[0]")
emitln("")
emitln("def emit(string):")
emitln(" sys.stdout.write(string)")
emitln("")
emitln("def trace(header, value):")
emitln(" if os.environ.get('TRACE'):")
emitln(" sys.stderr.write(f'{header}={value!r}\\n')")
emitln("")
emitln("eof = chr(0)")
emitln("eol = chr(10)")
emitln("quote = chr(34)")
emitln("PEEK = None")
emitln("LINE = 1")
emitln("")
emitln("def peek():")
emitln(" global PEEK")
emitln(" if PEEK is None:")
emitln(" char = sys.stdin.read(1)")
emitln(" trace('char', char)")
emitln(" if not char:")
emitln(" PEEK = eof")
emitln(" else:")
emitln(" PEEK = char")
emitln(" return PEEK")
emitln("")
emitln("peek()")
emitln("")
emitln("def skip():")
emitln(" global LINE")
emitln(" global PEEK")
emitln(" if eol == PEEK:")
emitln(" LINE += 1")
emitln(" PEEK = None")
emitln("")
emitln("def skipchar(char):")
emitln(" global LINE")
emitln(" assert char == peek(), (LINE, char, peek())")
emitln(" skip()")
emitln("")
def emitfooter(): def emitfooter():
emit("if __name__ == '__main__':\n") footer = fileget("it0-in-footer.py")
emit(" main()\n") emit(footer)
def main(): def main():
emitheader() emitheader()

2
it1-in-footer.py Normal file
View File

@ -0,0 +1,2 @@
if __name__ == '__main__':
main()

51
it1-in-header.py Normal file
View File

@ -0,0 +1,51 @@
import os
import sys
def eq(a, b):
return a == b
def lt(a, b):
return a[0] < b[0]
def addstringchar(a, b):
return a + b[0]
def emit(string):
sys.stdout.write(string)
def trace(header, value):
if os.environ.get('TRACE'):
sys.stderr.write(f'{header}={value!r}\\n')
eof = chr(0)
eol = chr(10)
quote = chr(34)
PEEK = None
LINE = 1
def peek():
global PEEK
if PEEK is None:
char = sys.stdin.read(1)
trace('char', char)
if not char:
PEEK = eof
else:
PEEK = char
return PEEK
def skip():
global LINE
global PEEK
if eol == PEEK:
LINE += 1
PEEK = None
def skipchar(char):
global LINE
assert char == peek(), (LINE, char, peek())
skip()
def fileget(path):
with open(f'./{path}', encoding='ASCII') as fil:
return fil.read()

View File

@ -1,8 +1,3 @@
emitln data:
emit data
emit eol
/
increaseindent indent: increaseindent indent:
calc indent addstringchar indent " " calc indent addstringchar indent " "
calc indent addstringchar indent " " calc indent addstringchar indent " "
@ -124,7 +119,7 @@ parsestatif indent:
emit indent emit indent
emit "if " emit "if "
parseexprvarref parseexprvarref
emitln ":" emit ":\n"
skipchar eol skipchar eol
calc indent increaseindent indent calc indent increaseindent indent
parseblock indent parseblock indent
@ -132,7 +127,7 @@ parsestatif indent:
parsestatforever indent: parsestatforever indent:
emit indent emit indent
emitln "while True:" emit "while True:\n"
skipchar eol skipchar eol
calc indent increaseindent indent calc indent increaseindent indent
parseblock indent parseblock indent
@ -140,7 +135,7 @@ parsestatforever indent:
parsestatbreak indent: parsestatbreak indent:
emit indent emit indent
emitln "break" emit "break\n"
skipchar eol skipchar eol
/ /
@ -167,7 +162,7 @@ parsestattrace indent:
emit quote emit quote
emit ", " emit ", "
emit varname emit varname
emitln ")" emit ")\n"
skipchar eol skipchar eol
/ /
@ -243,7 +238,7 @@ parsestat indent:
set first "0" set first "0"
/ /
skipchar eol skipchar eol
emitln ")" emit ")\n"
/ /
parseblock indent: parseblock indent:
@ -312,74 +307,26 @@ parsefunc:
if iseoblock if iseoblock
skipchar "/" skipchar "/"
skipchar eol skipchar eol
emitln "):" emit "):\n"
emitln " pass # ahead declaration" emit " pass # ahead declaration\n"
emit eol emit "\n"
return return
/ /
skipchar ":" skipchar ":"
skipchar eol skipchar eol
emitln "):" emit "):\n"
parseblock " " parseblock " "
emit eol emit "\n"
/ /
emitheader: emitheader:
emitln "import os" calc header fileget "it1-in-header.py"
emitln "import sys" emit header
emitln ""
emitln "def eq(a, b):"
emitln " return a == b"
emitln ""
emitln "def lt(a, b):"
emitln " return a[0] < b[0]"
emitln ""
emitln "def addstringchar(a, b):"
emitln " return a + b[0]"
emitln ""
emitln "def emit(string):"
emitln " sys.stdout.write(string)"
emitln ""
emitln "def trace(header, value):"
emitln " if os.environ.get('TRACE'):"
emitln " sys.stderr.write(f'{header}={value!r}\')"
emitln ""
emitln "eof = chr(0)"
emitln "eol = chr(10)"
emitln "quote = chr(34)"
emitln "PEEK = None"
emitln "LINE = 1"
emitln ""
emitln "def peek():"
emitln " global PEEK"
emitln " if PEEK is None:"
emitln " char = sys.stdin.read(1)"
emitln " trace('char', char)"
emitln " if not char:"
emitln " PEEK = eof"
emitln " else:"
emitln " PEEK = char"
emitln " return PEEK"
emitln ""
emitln "peek()"
emitln ""
emitln "def skip():"
emitln " global LINE"
emitln " global PEEK"
emitln " if eol == PEEK:"
emitln " LINE += 1"
emitln " PEEK = None"
emitln ""
emitln "def skipchar(char):"
emitln " global LINE"
emitln " assert char == peek(), (LINE, char, peek())"
emitln " skip()"
emitln ""
/ /
emitfooter: emitfooter:
emitln "if __name__ == '__main__':" calc header fileget "it1-in-footer.py"
emitln " main()" emit header
/ /
main: main:

136
it2-in-header.c Normal file
View File

@ -0,0 +1,136 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char var_eof[2] = {-1, 0};
char var_eol[2] = {10, 0};
char var_quote[2] = {34, 0};
char var_false[1] = {0};
char var_true[2] = {'1', 0};
char * eq(char * a, char * b)
{
return (strcmp(a, b) == 0) ? var_true : var_false;
}
char * lt(char * a, char * b)
{
return (strcmp(a, b) < 0) ? var_true : var_false;
}
char * not(char * a)
{
return (strcmp(a, var_true) != 0) ? var_true : var_false;
}
char * addstringchar(char * str, char * chr)
{
int str_len = strlen(str);
assert(strlen(chr) == 1);
char * res = malloc((str_len + 2) * sizeof(char));
strcpy(res, str);
res[str_len + 0] = chr[0];
res[str_len + 1] = 0;
return res;
}
char * emit(char * str)
{
fputs(str, stdout);
return 0;
}
char * trace(char * var_name, char * var_value)
{
const char * env_trace = getenv("TRACE");
if( !env_trace ) return 0;
fputs(var_name, stderr);
fputs("=", stderr);
fputs(var_value, stderr);
fputs(var_eol, stderr);
return 0;
}
int LINE = 1;
char * peek()
{
char * res = malloc(2*sizeof(char));
res[0] = getc(stdin);
res[1] = 0;
ungetc(res[0], stdin);
return res;
}
void skip()
{
char c = getc(stdin);
if( c == 10 ) LINE += 1;
}
void skipchar(char * chr)
{
assert(strlen(chr) == 1);
char * act = peek();
assert(strlen(act) == 1);
if( chr[0] == act[0] ) {skip(); return;};
fprintf(stderr, "Expected '%c' on line %d but saw '%c' instead\n", chr[0], LINE, act[0]);
exit(1);
}
char * fileget(char * var_path)
{
FILE * file_ptr;
int file_size;
char * res;
file_ptr = fopen(var_path, "r");
if( NULL == file_ptr ) {
fprintf(stderr, "Could not load file %s", var_path);
exit(1);
}
fseek(file_ptr, 0, SEEK_END);
file_size = ftell(file_ptr);
fseek(file_ptr, 0, SEEK_SET);
res = malloc(file_size * sizeof(char));
fread(res, sizeof(char), file_size, file_ptr);
fclose(file_ptr);
return res;
}
void mapclear(char * map_name)
{
}
void mapsetkey(char * map_name, char * key, char * value)
{
}
char * mapgetkey(char * map_name, char * key)
{
return "0";
}
char * intinc(char * a)
{
int len = strlen(a);
int val;
int read = sscanf(a, "%d", &val);
if( len != read ) {
return "1";
}
val += 1;
char * res = malloc((len + 1) * sizeof(char));
sprintf(res, "%d", val);
return res;
}

View File

@ -1,8 +1,3 @@
emitln data:
emit data
emit eol
/
increaseindent indent: increaseindent indent:
calc indent addstringchar indent " " calc indent addstringchar indent " "
calc indent addstringchar indent " " calc indent addstringchar indent " "
@ -160,34 +155,34 @@ parsestatif indent:
emit indent emit indent
emit "if ( 0 < strlen(" emit "if ( 0 < strlen("
parseexprvarref parseexprvarref
emitln ") )" emit ") )\n"
emit indent emit indent
emitln "{" emit "{\n"
skipchar eol skipchar eol
calc indentt increaseindent indent calc indentt increaseindent indent
parseblock indentt parseblock indentt
emit indent emit indent
emitln "}" emit "}\n"
return return
/ /
parsestatforever indent: parsestatforever indent:
declare indentt declare indentt
emit indent emit indent
emitln "while (1)" emit "while (1)\n"
emit indent emit indent
emitln "{" emit "{\n"
skipchar eol skipchar eol
calc indentt increaseindent indent calc indentt increaseindent indent
parseblock indentt parseblock indentt
emit indent emit indent
emitln "}" emit "}\n"
return return
/ /
parsestatbreak indent: parsestatbreak indent:
emit indent emit indent
emitln "break;" emit "break;\n"
skipchar eol skipchar eol
return return
/ /
@ -225,7 +220,7 @@ parsestattrace indent:
emit quote emit quote
emit ", var_" emit ", var_"
emit varname emit varname
emitln ");" emit ");\n"
skipchar eol skipchar eol
return return
/ /
@ -295,6 +290,11 @@ parsestat indent:
break break
/ /
skip skip
calc isfirst eq first "1"
calc isnotfirst not isfirst
if isnotfirst
emit ", "
/
calc char peek calc char peek
calc isquote eq char quote calc isquote eq char quote
calc isnotquote not isquote calc isnotquote not isquote
@ -304,15 +304,10 @@ parsestat indent:
if isnotquote if isnotquote
parseexprvarref parseexprvarref
/ /
calc isfirst eq first "1"
calc isnotfirst not isfirst
if isnotfirst
emit ", "
/
set first "0" set first "0"
/ /
skipchar eol skipchar eol
emitln ");" emit ");\n"
return return
/ /
@ -394,119 +389,26 @@ parsefunc:
if iseoblock if iseoblock
skipchar "/" skipchar "/"
skipchar eol skipchar eol
emitln ");" emit ");"
emit "\n"
return return
/ /
skipchar ":" skipchar ":"
skipchar eol skipchar eol
emitln ")" emit ")\n{\n"
emitln "{"
parseblock " " parseblock " "
emitln "}" emit "}\n\n"
emit eol
return return
/ /
emitheader: emitheader:
emitln "#include <assert.h>" declare header
emitln "#include <stdio.h>" calc header fileget "it2-in-header.c"
emitln "#include <stdlib.h>" emit header
emitln "#include <string.h>"
emitln ""
emitln ""
emitln "char var_eof[2] = {-1, 0};"
emitln "char var_eol[2] = {10, 0};"
emitln "char var_quote[2] = {34, 0};"
emitln "char var_false[1] = {0};"
emitln "char var_true[2] = {'1', 0};"
emitln ""
emitln ""
emitln "char * eq(char * a, char * b)"
emitln "{"
emitln " return (strcmp(a, b) == 0) ? var_true : var_false;"
emitln "}"
emitln ""
emitln "char * lt(char * a, char * b)"
emitln "{"
emitln " return (strcmp(a, b) < 0) ? var_true : var_false;"
emitln "}"
emitln "char * not(char * a)"
emitln "{"
emitln " return (strcmp(a, var_true) != 0) ? var_true : var_false;"
emitln "}"
emitln ""
emitln "char * addstringchar(char * str, char * chr)"
emitln "{"
emitln " int str_len = strlen(str);"
emitln " assert(strlen(chr) == 1);"
emitln " char * res = malloc((str_len + 2) * sizeof(char));"
emitln " strcpy(res, str);"
emitln " res[str_len + 0] = chr[0];"
emitln " res[str_len + 1] = 0;"
emitln " return res;"
emitln "}"
emitln ""
emitln "char * emit(char * str)"
emitln "{"
emitln " fputs(str, stdout);"
emitln " return 0;"
emitln "}"
emitln ""
emitln "char * trace(char * var_name, char * var_value)"
emitln "{"
emit " const char * env_trace = getenv("
emit quote
emit "TRACE"
emit quote
emitln ");"
emitln " if( !env_trace ) return 0;"
emitln " fputs(var_name, stderr);"
emit " fputs("
emit quote
emit "="
emit quote
emitln ", stderr);"
emitln " fputs(var_value, stderr);"
emitln " fputs(var_eol, stderr);"
emitln " return 0;"
emitln "}"
emitln ""
emitln "int LINE = 1;"
emitln ""
emitln "char * peek()"
emitln "{"
emitln " char * res = malloc(2*sizeof(char));"
emitln " res[0] = getc(stdin);"
emitln " res[1] = 0;"
emitln " ungetc(res[0], stdin);"
emitln " return res;"
emitln "}"
emitln ""
emitln "void skip()"
emitln "{"
emitln " char c = getc(stdin);"
emitln " if( c == 10 ) LINE += 1;"
emitln "}"
emitln ""
emitln "void skipchar(char * chr)"
emitln "{"
emitln " assert(strlen(chr) == 1);"
emitln " char * act = peek();"
emitln " assert(strlen(act) == 1);"
emitln " if( chr[0] == act[0] ) {skip(); return;};"
emit " fprintf(stderr, "
emit quote
emit "Expected '%c' on line %d but saw '%c' instead%c"
emit quote
emitln ", chr[0], LINE, act[0], 10);"
emitln " exit(1);"
emitln "}"
emitln ""
return return
/ /
emitfooter: emitfooter:
emit ""
return return
/ /

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 151 KiB

1
tests/.gitignore vendored
View File

@ -1 +0,0 @@
/*.results

View File

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

View File

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

View File

@ -1,6 +0,0 @@
main:
forever
break
/
emit "Success"
/

View File

@ -1,8 +0,0 @@
func:
emit "Success"
return
/
main:
func
/

View File

@ -1,8 +0,0 @@
main:
declare bool
set bool ""
if bool
return
/
emit "Success"
/

View File

@ -1,7 +0,0 @@
main:
declare bool
set bool "1"
if bool
emit "Success"
/
/

View File

@ -1,8 +0,0 @@
func:
return
/
main:
func
emit "Success"
/

View File

@ -1,11 +0,0 @@
func:
declare result
set result "Success"
return result
/
main:
declare result
calc result func
emit result
/

View File

@ -1,11 +0,0 @@
func result/
main:
declare result
calc result func "Success"
emit result
/
func result:
return result
/

View File

@ -1,5 +0,0 @@
main:
declare result
calc result addstringchar "Succes" "s"
emit result
/

View File

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

View File

@ -1,8 +0,0 @@
main:
declare bool
calc bool eq "1" "2"
if bool
return
/
emit "Success"
/

View File

@ -1,7 +0,0 @@
main:
declare bool
calc bool eq "1" "1"
if bool
emit "Success"
/
/

View File

@ -1,8 +0,0 @@
main:
declare bool
calc bool lt "b" "a"
if bool
return
/
emit "Success"
/

View File

@ -1,7 +0,0 @@
main:
declare bool
calc bool lt "a" "b"
if bool
emit "Success"
/
/

View File

@ -1,9 +0,0 @@
main:
declare char
declare ish
calc char peek
calc ish eq char "H"
if ish
emit "Success"
/
/

View File

@ -1,24 +0,0 @@
main:
declare char
declare ish
declare iso
declare notish
declare notiso
skip
calc char peek
calc ish eq char "e"
calc notish not ish
if notish
return
/
skip
skip
skip
calc char peek
calc iso eq char "o"
calc notiso not iso
if notish
return
/
emit "Success"
/

View File

@ -1,9 +0,0 @@
func result:
return result
/
main:
declare result
calc result func "Success"
emit result
/

View File

@ -1,5 +0,0 @@
main:
declare result
set result "Success"
emit result
/