Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,33 @@
Module Checkit {
Module Alfa {
10 Rem this code is like basic
20 Let K%=1
30 Let A=2
40 Print "Begin"
50 On K% Gosub 110
60 If A=2 then 520
70 For I=1 to 10
80 if i>5 then exit for 120
90 Gosub 110
100 Next i
110 On A Goto 150, 500
120 Print "This is the End ?"
130 Return
150 Print "from loop pass here", i
160 Return
200 Print "ok"
210 Return
500 Print "Routine 500"
510 Goto 200
520 Let A=1
530 Gosub 70
540 Print "Yes"
}
Alfa
\\ this can be done. Code executed like it is from this module
\\ because 200 is a label inside code of Module Checkit
\\ and search is not so smart. After first search. position saved in a hash table
Gosub 200 ' print "ok"
Gosub 200 ' print "ok"
}
Checkit

View file

@ -0,0 +1,23 @@
Module LikeRunBasic {
for i = 1 to 10
if i = 5 then goto label5
next i
end
label5:
print i
while i < 10 {
if i = 6 then goto label6
i = i + 1
}
end
label6:
print i
if i = 6 then goto finish
print "Why am I here"
finish:
print "done"
}
LikeRunBasic

View file

@ -0,0 +1,80 @@
Module LikeGo {
\\ simulate Go for
\\ need to make var Empty, swapping uninitialized array item
Module EmptyVar (&x) {
Dim A(1)
Swap A(0), x
}
Function GoFor(&i, first, comp$, step$) {
\\ checking for empty we now if i get first value
if type$(i)="Empty" then {
i=first
} else {
i+=Eval(step$)
}
if Eval("i"+comp$) Else Exit
=true
}
def i, j
EmptyVar &i
outer:
{
if GoFor(&i, 0, "<4", "+1") else exit
EmptyVar &j
{
if GoFor(&j, 0, "<4", "+1") else exit
if i+j== 4 then goto outer
if i+j == 5 then goto break_outer
print i+j
loop
}
loop
}
break_outer:
k = 3
if k == 3 Then Goto later
Print k \\ never executed
later:
k++
Print k
}
LikeGo
\\ or we can use For {} block and put label outer to right place
Module LikeGo {
For i=0 to 3 {
For j=0 to 3 {
if i+j== 4 then goto outer
if i+j == 5 then goto break_outer
print i+j
}
outer:
}
break_outer:
k = 3
if k == 3 Then Goto later
Print k \\ never executed
later:
k++
Print k
}
LikeGo
Module LikeGo_No_Labels {
For i=0 to 3 {
For j=0 to 3 {
if i+j== 4 then exit ' exit breaks only one block
if i+j == 5 then break ' break breaks all blocks, but not the Module's block.
print i+j
}
}
k = 3
if k == 3 Else {
Print k \\ never executed
}
k++
Print k
}
LikeGo_No_Labels