kaya-0.4.4/ 0000755 0001751 0001751 00000000000 11170340772 010552 5 ustar cim cim kaya-0.4.4/LGPL3 0000644 0001751 0001751 00000016727 11170340770 011331 0 ustar cim cim GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
kaya-0.4.4/tests/ 0000755 0001751 0001751 00000000000 11170340770 011712 5 ustar cim cim kaya-0.4.4/tests/runtest.pl 0000644 0001751 0001751 00000002772 11170340770 013763 0 ustar cim cim #!/usr/bin/perl
my $exitstatus = 0;
sub runtest {
my ($test, $update) = @_;
chdir($test);
print "Running $test...";
$got = `sh ./run`;
$exp = `cat expected`;
open(OUT,">output");
print OUT $got;
close(OUT);
# $ok = system("diff output expected &> /dev/null");
# Mangle newlines in $got and $exp
$got =~ s/\r\n/\n/g;
$exp =~ s/\r\n/\n/g;
if ($got eq $exp) {
print "success\n";
} else {
if ($update == 0) {
$exitstatus = 1;
print "FAILURE\n";
} else {
system("cp output expected");
print "UPDATED\n";
}
}
chdir("..");
}
if ($#ARGV>=0) {
$test=shift(@ARGV);
if ($test eq "all") {
opendir(DIR, ".");
@list = readdir(DIR);
foreach $file (@list) {
if ($file =~ /^test/) {
push(@tests,$file);
}
}
@tests = sort @tests;
}
else
{
push(@tests, $test);
}
@opts = @ARGV;
} else {
print "Give a test name, or 'all' to run all.\n";
exit;
}
$update=0;
$diff=0;
$show=0;
while ($opt=shift(@opts)) {
if ($opt eq "-u") { $update = 1; }
if ($opt eq "-d") { $diff = 1; }
if ($opt eq "-s") { $show = 1; }
}
foreach $test (@tests) {
if ($diff == 0 && $show == 0) {
runtest($test,$update);
}
else {
chdir($test);
if ($show == 1) {
system("cat output");
}
if ($diff == 1) {
print "Differences in $test:\n";
$ok = system("diff output expected");
if ($ok == 0) {
print "No differences found.\n";
}
}
chdir("..");
}
}
exit $exitstatus;
kaya-0.4.4/tests/test035/ 0000755 0001751 0001751 00000000000 11170340767 013127 5 ustar cim cim kaya-0.4.4/tests/test035/test035.k 0000644 0001751 0001751 00000000440 11170340767 014510 0 ustar cim cim program test035;
Void runScary(String function) {
Int(Int,Int) realfn = unmarshal(function,888);
putStrLn("Result is "+realfn(5,32));
}
Void main() {
z = 5;
plus = \(Int x,Int y) -> x+y+z;
plusm = marshal(plus,888);
// putStrLn(plusm);
runScary(plusm);
}
kaya-0.4.4/tests/test035/expected 0000644 0001751 0001751 00000000047 11170340767 014654 0 ustar cim cim Compiling program test035
Result is 42
kaya-0.4.4/tests/test035/run 0000644 0001751 0001751 00000000230 11170340767 013651 0 ustar cim cim #!/bin/bash
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../rts/
../../compiler/kayac test035.k -L ../../rts -L ../../stdlib
./test035
rm -f test035 test035.exe
kaya-0.4.4/tests/test002/ 0000755 0001751 0001751 00000000000 11170340770 013113 5 ustar cim cim kaya-0.4.4/tests/test002/test002.k 0000644 0001751 0001751 00000001315 11170340770 014470 0 ustar cim cim // -*-C-*-
program test002;
import Array;
import Strings;
Int add(var Int x, var Int y) {
return x+y;
}
[Int] testarr() {
arr = [];
for x in [1..10] {
for y in [5,3..-9] {
push(arr,x*y);
}
}
return arr;
}
Void main()
{
for y in range(10,20) {
for z in range(1,5) {
putStr( String(y)+"-"+String(z)+",");
}
putStr("\n");
}
// print "Enter a number:";
// val = stringToInt(get(stdin()));
val = 100;
x = fold(add, range(1,val),0);
putStr( "The sum of numbers from 1 to " + String(val) + " is " + String(x) + "\n");
for n in testarr {
putStr(n+",");
}
putStr("\n");
for m in testarr() {
putStr(m+",");
}
putStr("\n");
}
kaya-0.4.4/tests/test002/expected 0000644 0001751 0001751 00000001557 11170340770 014647 0 ustar cim cim Compiling program test002
10-1,10-2,10-3,10-4,10-5,
11-1,11-2,11-3,11-4,11-5,
12-1,12-2,12-3,12-4,12-5,
13-1,13-2,13-3,13-4,13-5,
14-1,14-2,14-3,14-4,14-5,
15-1,15-2,15-3,15-4,15-5,
16-1,16-2,16-3,16-4,16-5,
17-1,17-2,17-3,17-4,17-5,
18-1,18-2,18-3,18-4,18-5,
19-1,19-2,19-3,19-4,19-5,
20-1,20-2,20-3,20-4,20-5,
The sum of numbers from 1 to 100 is 5050
5,3,1,-1,-3,-5,-7,-9,10,6,2,-2,-6,-10,-14,-18,15,9,3,-3,-9,-15,-21,-27,20,12,4,-4,-12,-20,-28,-36,25,15,5,-5,-15,-25,-35,-45,30,18,6,-6,-18,-30,-42,-54,35,21,7,-7,-21,-35,-49,-63,40,24,8,-8,-24,-40,-56,-72,45,27,9,-9,-27,-45,-63,-81,50,30,10,-10,-30,-50,-70,-90,
5,3,1,-1,-3,-5,-7,-9,10,6,2,-2,-6,-10,-14,-18,15,9,3,-3,-9,-15,-21,-27,20,12,4,-4,-12,-20,-28,-36,25,15,5,-5,-15,-25,-35,-45,30,18,6,-6,-18,-30,-42,-54,35,21,7,-7,-21,-35,-49,-63,40,24,8,-8,-24,-40,-56,-72,45,27,9,-9,-27,-45,-63,-81,50,30,10,-10,-30,-50,-70,-90,
kaya-0.4.4/tests/test002/run 0000644 0001751 0001751 00000000241 11170340767 013645 0 ustar cim cim #!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../rts/
../../compiler/kayac test002.k -L ../../rts -L ../../stdlib
./test002
rm -f test002 test002.exe
kaya-0.4.4/tests/test055/ 0000755 0001751 0001751 00000000000 11170340770 013123 5 ustar cim cim kaya-0.4.4/tests/test055/test055.k 0000644 0001751 0001751 00000000437 11170340770 014514 0 ustar cim cim program test055;
Int getNum(Int a) {
z = 1;
if (a % 2 == 0) {
return 10;
} else {
return 208;
}
}
Int constA = 44;
Int constB = 17;
(Int,Int) mkVal() {
return (10+getNum(constA-4),215+getNum(constB-4));
}
Void main() {
m = mkVal();
putStrLn(m.fst+","+m.snd);
}
kaya-0.4.4/tests/test055/expected 0000644 0001751 0001751 00000000041 11170340770 014642 0 ustar cim cim Compiling program test055
20,423
kaya-0.4.4/tests/test055/run 0000644 0001751 0001751 00000000230 11170340770 013645 0 ustar cim cim #!/bin/bash
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../rts/
../../compiler/kayac test055.k -L ../../rts -L ../../stdlib
./test055
rm -f test055 test055.exe
kaya-0.4.4/tests/test009/ 0000755 0001751 0001751 00000000000 11170340767 013130 5 ustar cim cim kaya-0.4.4/tests/test009/test009.k 0000644 0001751 0001751 00000000374 11170340766 014517 0 ustar cim cim // -*-C-*-ish
program array;
Void main()
{
for(y=0;y<30;y=y+1) {
for(x=0;x<30;x=x+1) {
i[x][y] = x*y;
}
}
for(y=0;y<30;y=y+1) {
for(x=0;x<30;x=x+1) {
putStr( String(x)+"*"+String(y)+" = " + String(i[x][y])+"\n");
}
}
}
kaya-0.4.4/tests/test009/expected 0000644 0001751 0001751 00000023106 11170340767 014656 0 ustar cim cim Compiling program array
0*0 = 0
1*0 = 0
2*0 = 0
3*0 = 0
4*0 = 0
5*0 = 0
6*0 = 0
7*0 = 0
8*0 = 0
9*0 = 0
10*0 = 0
11*0 = 0
12*0 = 0
13*0 = 0
14*0 = 0
15*0 = 0
16*0 = 0
17*0 = 0
18*0 = 0
19*0 = 0
20*0 = 0
21*0 = 0
22*0 = 0
23*0 = 0
24*0 = 0
25*0 = 0
26*0 = 0
27*0 = 0
28*0 = 0
29*0 = 0
0*1 = 0
1*1 = 1
2*1 = 2
3*1 = 3
4*1 = 4
5*1 = 5
6*1 = 6
7*1 = 7
8*1 = 8
9*1 = 9
10*1 = 10
11*1 = 11
12*1 = 12
13*1 = 13
14*1 = 14
15*1 = 15
16*1 = 16
17*1 = 17
18*1 = 18
19*1 = 19
20*1 = 20
21*1 = 21
22*1 = 22
23*1 = 23
24*1 = 24
25*1 = 25
26*1 = 26
27*1 = 27
28*1 = 28
29*1 = 29
0*2 = 0
1*2 = 2
2*2 = 4
3*2 = 6
4*2 = 8
5*2 = 10
6*2 = 12
7*2 = 14
8*2 = 16
9*2 = 18
10*2 = 20
11*2 = 22
12*2 = 24
13*2 = 26
14*2 = 28
15*2 = 30
16*2 = 32
17*2 = 34
18*2 = 36
19*2 = 38
20*2 = 40
21*2 = 42
22*2 = 44
23*2 = 46
24*2 = 48
25*2 = 50
26*2 = 52
27*2 = 54
28*2 = 56
29*2 = 58
0*3 = 0
1*3 = 3
2*3 = 6
3*3 = 9
4*3 = 12
5*3 = 15
6*3 = 18
7*3 = 21
8*3 = 24
9*3 = 27
10*3 = 30
11*3 = 33
12*3 = 36
13*3 = 39
14*3 = 42
15*3 = 45
16*3 = 48
17*3 = 51
18*3 = 54
19*3 = 57
20*3 = 60
21*3 = 63
22*3 = 66
23*3 = 69
24*3 = 72
25*3 = 75
26*3 = 78
27*3 = 81
28*3 = 84
29*3 = 87
0*4 = 0
1*4 = 4
2*4 = 8
3*4 = 12
4*4 = 16
5*4 = 20
6*4 = 24
7*4 = 28
8*4 = 32
9*4 = 36
10*4 = 40
11*4 = 44
12*4 = 48
13*4 = 52
14*4 = 56
15*4 = 60
16*4 = 64
17*4 = 68
18*4 = 72
19*4 = 76
20*4 = 80
21*4 = 84
22*4 = 88
23*4 = 92
24*4 = 96
25*4 = 100
26*4 = 104
27*4 = 108
28*4 = 112
29*4 = 116
0*5 = 0
1*5 = 5
2*5 = 10
3*5 = 15
4*5 = 20
5*5 = 25
6*5 = 30
7*5 = 35
8*5 = 40
9*5 = 45
10*5 = 50
11*5 = 55
12*5 = 60
13*5 = 65
14*5 = 70
15*5 = 75
16*5 = 80
17*5 = 85
18*5 = 90
19*5 = 95
20*5 = 100
21*5 = 105
22*5 = 110
23*5 = 115
24*5 = 120
25*5 = 125
26*5 = 130
27*5 = 135
28*5 = 140
29*5 = 145
0*6 = 0
1*6 = 6
2*6 = 12
3*6 = 18
4*6 = 24
5*6 = 30
6*6 = 36
7*6 = 42
8*6 = 48
9*6 = 54
10*6 = 60
11*6 = 66
12*6 = 72
13*6 = 78
14*6 = 84
15*6 = 90
16*6 = 96
17*6 = 102
18*6 = 108
19*6 = 114
20*6 = 120
21*6 = 126
22*6 = 132
23*6 = 138
24*6 = 144
25*6 = 150
26*6 = 156
27*6 = 162
28*6 = 168
29*6 = 174
0*7 = 0
1*7 = 7
2*7 = 14
3*7 = 21
4*7 = 28
5*7 = 35
6*7 = 42
7*7 = 49
8*7 = 56
9*7 = 63
10*7 = 70
11*7 = 77
12*7 = 84
13*7 = 91
14*7 = 98
15*7 = 105
16*7 = 112
17*7 = 119
18*7 = 126
19*7 = 133
20*7 = 140
21*7 = 147
22*7 = 154
23*7 = 161
24*7 = 168
25*7 = 175
26*7 = 182
27*7 = 189
28*7 = 196
29*7 = 203
0*8 = 0
1*8 = 8
2*8 = 16
3*8 = 24
4*8 = 32
5*8 = 40
6*8 = 48
7*8 = 56
8*8 = 64
9*8 = 72
10*8 = 80
11*8 = 88
12*8 = 96
13*8 = 104
14*8 = 112
15*8 = 120
16*8 = 128
17*8 = 136
18*8 = 144
19*8 = 152
20*8 = 160
21*8 = 168
22*8 = 176
23*8 = 184
24*8 = 192
25*8 = 200
26*8 = 208
27*8 = 216
28*8 = 224
29*8 = 232
0*9 = 0
1*9 = 9
2*9 = 18
3*9 = 27
4*9 = 36
5*9 = 45
6*9 = 54
7*9 = 63
8*9 = 72
9*9 = 81
10*9 = 90
11*9 = 99
12*9 = 108
13*9 = 117
14*9 = 126
15*9 = 135
16*9 = 144
17*9 = 153
18*9 = 162
19*9 = 171
20*9 = 180
21*9 = 189
22*9 = 198
23*9 = 207
24*9 = 216
25*9 = 225
26*9 = 234
27*9 = 243
28*9 = 252
29*9 = 261
0*10 = 0
1*10 = 10
2*10 = 20
3*10 = 30
4*10 = 40
5*10 = 50
6*10 = 60
7*10 = 70
8*10 = 80
9*10 = 90
10*10 = 100
11*10 = 110
12*10 = 120
13*10 = 130
14*10 = 140
15*10 = 150
16*10 = 160
17*10 = 170
18*10 = 180
19*10 = 190
20*10 = 200
21*10 = 210
22*10 = 220
23*10 = 230
24*10 = 240
25*10 = 250
26*10 = 260
27*10 = 270
28*10 = 280
29*10 = 290
0*11 = 0
1*11 = 11
2*11 = 22
3*11 = 33
4*11 = 44
5*11 = 55
6*11 = 66
7*11 = 77
8*11 = 88
9*11 = 99
10*11 = 110
11*11 = 121
12*11 = 132
13*11 = 143
14*11 = 154
15*11 = 165
16*11 = 176
17*11 = 187
18*11 = 198
19*11 = 209
20*11 = 220
21*11 = 231
22*11 = 242
23*11 = 253
24*11 = 264
25*11 = 275
26*11 = 286
27*11 = 297
28*11 = 308
29*11 = 319
0*12 = 0
1*12 = 12
2*12 = 24
3*12 = 36
4*12 = 48
5*12 = 60
6*12 = 72
7*12 = 84
8*12 = 96
9*12 = 108
10*12 = 120
11*12 = 132
12*12 = 144
13*12 = 156
14*12 = 168
15*12 = 180
16*12 = 192
17*12 = 204
18*12 = 216
19*12 = 228
20*12 = 240
21*12 = 252
22*12 = 264
23*12 = 276
24*12 = 288
25*12 = 300
26*12 = 312
27*12 = 324
28*12 = 336
29*12 = 348
0*13 = 0
1*13 = 13
2*13 = 26
3*13 = 39
4*13 = 52
5*13 = 65
6*13 = 78
7*13 = 91
8*13 = 104
9*13 = 117
10*13 = 130
11*13 = 143
12*13 = 156
13*13 = 169
14*13 = 182
15*13 = 195
16*13 = 208
17*13 = 221
18*13 = 234
19*13 = 247
20*13 = 260
21*13 = 273
22*13 = 286
23*13 = 299
24*13 = 312
25*13 = 325
26*13 = 338
27*13 = 351
28*13 = 364
29*13 = 377
0*14 = 0
1*14 = 14
2*14 = 28
3*14 = 42
4*14 = 56
5*14 = 70
6*14 = 84
7*14 = 98
8*14 = 112
9*14 = 126
10*14 = 140
11*14 = 154
12*14 = 168
13*14 = 182
14*14 = 196
15*14 = 210
16*14 = 224
17*14 = 238
18*14 = 252
19*14 = 266
20*14 = 280
21*14 = 294
22*14 = 308
23*14 = 322
24*14 = 336
25*14 = 350
26*14 = 364
27*14 = 378
28*14 = 392
29*14 = 406
0*15 = 0
1*15 = 15
2*15 = 30
3*15 = 45
4*15 = 60
5*15 = 75
6*15 = 90
7*15 = 105
8*15 = 120
9*15 = 135
10*15 = 150
11*15 = 165
12*15 = 180
13*15 = 195
14*15 = 210
15*15 = 225
16*15 = 240
17*15 = 255
18*15 = 270
19*15 = 285
20*15 = 300
21*15 = 315
22*15 = 330
23*15 = 345
24*15 = 360
25*15 = 375
26*15 = 390
27*15 = 405
28*15 = 420
29*15 = 435
0*16 = 0
1*16 = 16
2*16 = 32
3*16 = 48
4*16 = 64
5*16 = 80
6*16 = 96
7*16 = 112
8*16 = 128
9*16 = 144
10*16 = 160
11*16 = 176
12*16 = 192
13*16 = 208
14*16 = 224
15*16 = 240
16*16 = 256
17*16 = 272
18*16 = 288
19*16 = 304
20*16 = 320
21*16 = 336
22*16 = 352
23*16 = 368
24*16 = 384
25*16 = 400
26*16 = 416
27*16 = 432
28*16 = 448
29*16 = 464
0*17 = 0
1*17 = 17
2*17 = 34
3*17 = 51
4*17 = 68
5*17 = 85
6*17 = 102
7*17 = 119
8*17 = 136
9*17 = 153
10*17 = 170
11*17 = 187
12*17 = 204
13*17 = 221
14*17 = 238
15*17 = 255
16*17 = 272
17*17 = 289
18*17 = 306
19*17 = 323
20*17 = 340
21*17 = 357
22*17 = 374
23*17 = 391
24*17 = 408
25*17 = 425
26*17 = 442
27*17 = 459
28*17 = 476
29*17 = 493
0*18 = 0
1*18 = 18
2*18 = 36
3*18 = 54
4*18 = 72
5*18 = 90
6*18 = 108
7*18 = 126
8*18 = 144
9*18 = 162
10*18 = 180
11*18 = 198
12*18 = 216
13*18 = 234
14*18 = 252
15*18 = 270
16*18 = 288
17*18 = 306
18*18 = 324
19*18 = 342
20*18 = 360
21*18 = 378
22*18 = 396
23*18 = 414
24*18 = 432
25*18 = 450
26*18 = 468
27*18 = 486
28*18 = 504
29*18 = 522
0*19 = 0
1*19 = 19
2*19 = 38
3*19 = 57
4*19 = 76
5*19 = 95
6*19 = 114
7*19 = 133
8*19 = 152
9*19 = 171
10*19 = 190
11*19 = 209
12*19 = 228
13*19 = 247
14*19 = 266
15*19 = 285
16*19 = 304
17*19 = 323
18*19 = 342
19*19 = 361
20*19 = 380
21*19 = 399
22*19 = 418
23*19 = 437
24*19 = 456
25*19 = 475
26*19 = 494
27*19 = 513
28*19 = 532
29*19 = 551
0*20 = 0
1*20 = 20
2*20 = 40
3*20 = 60
4*20 = 80
5*20 = 100
6*20 = 120
7*20 = 140
8*20 = 160
9*20 = 180
10*20 = 200
11*20 = 220
12*20 = 240
13*20 = 260
14*20 = 280
15*20 = 300
16*20 = 320
17*20 = 340
18*20 = 360
19*20 = 380
20*20 = 400
21*20 = 420
22*20 = 440
23*20 = 460
24*20 = 480
25*20 = 500
26*20 = 520
27*20 = 540
28*20 = 560
29*20 = 580
0*21 = 0
1*21 = 21
2*21 = 42
3*21 = 63
4*21 = 84
5*21 = 105
6*21 = 126
7*21 = 147
8*21 = 168
9*21 = 189
10*21 = 210
11*21 = 231
12*21 = 252
13*21 = 273
14*21 = 294
15*21 = 315
16*21 = 336
17*21 = 357
18*21 = 378
19*21 = 399
20*21 = 420
21*21 = 441
22*21 = 462
23*21 = 483
24*21 = 504
25*21 = 525
26*21 = 546
27*21 = 567
28*21 = 588
29*21 = 609
0*22 = 0
1*22 = 22
2*22 = 44
3*22 = 66
4*22 = 88
5*22 = 110
6*22 = 132
7*22 = 154
8*22 = 176
9*22 = 198
10*22 = 220
11*22 = 242
12*22 = 264
13*22 = 286
14*22 = 308
15*22 = 330
16*22 = 352
17*22 = 374
18*22 = 396
19*22 = 418
20*22 = 440
21*22 = 462
22*22 = 484
23*22 = 506
24*22 = 528
25*22 = 550
26*22 = 572
27*22 = 594
28*22 = 616
29*22 = 638
0*23 = 0
1*23 = 23
2*23 = 46
3*23 = 69
4*23 = 92
5*23 = 115
6*23 = 138
7*23 = 161
8*23 = 184
9*23 = 207
10*23 = 230
11*23 = 253
12*23 = 276
13*23 = 299
14*23 = 322
15*23 = 345
16*23 = 368
17*23 = 391
18*23 = 414
19*23 = 437
20*23 = 460
21*23 = 483
22*23 = 506
23*23 = 529
24*23 = 552
25*23 = 575
26*23 = 598
27*23 = 621
28*23 = 644
29*23 = 667
0*24 = 0
1*24 = 24
2*24 = 48
3*24 = 72
4*24 = 96
5*24 = 120
6*24 = 144
7*24 = 168
8*24 = 192
9*24 = 216
10*24 = 240
11*24 = 264
12*24 = 288
13*24 = 312
14*24 = 336
15*24 = 360
16*24 = 384
17*24 = 408
18*24 = 432
19*24 = 456
20*24 = 480
21*24 = 504
22*24 = 528
23*24 = 552
24*24 = 576
25*24 = 600
26*24 = 624
27*24 = 648
28*24 = 672
29*24 = 696
0*25 = 0
1*25 = 25
2*25 = 50
3*25 = 75
4*25 = 100
5*25 = 125
6*25 = 150
7*25 = 175
8*25 = 200
9*25 = 225
10*25 = 250
11*25 = 275
12*25 = 300
13*25 = 325
14*25 = 350
15*25 = 375
16*25 = 400
17*25 = 425
18*25 = 450
19*25 = 475
20*25 = 500
21*25 = 525
22*25 = 550
23*25 = 575
24*25 = 600
25*25 = 625
26*25 = 650
27*25 = 675
28*25 = 700
29*25 = 725
0*26 = 0
1*26 = 26
2*26 = 52
3*26 = 78
4*26 = 104
5*26 = 130
6*26 = 156
7*26 = 182
8*26 = 208
9*26 = 234
10*26 = 260
11*26 = 286
12*26 = 312
13*26 = 338
14*26 = 364
15*26 = 390
16*26 = 416
17*26 = 442
18*26 = 468
19*26 = 494
20*26 = 520
21*26 = 546
22*26 = 572
23*26 = 598
24*26 = 624
25*26 = 650
26*26 = 676
27*26 = 702
28*26 = 728
29*26 = 754
0*27 = 0
1*27 = 27
2*27 = 54
3*27 = 81
4*27 = 108
5*27 = 135
6*27 = 162
7*27 = 189
8*27 = 216
9*27 = 243
10*27 = 270
11*27 = 297
12*27 = 324
13*27 = 351
14*27 = 378
15*27 = 405
16*27 = 432
17*27 = 459
18*27 = 486
19*27 = 513
20*27 = 540
21*27 = 567
22*27 = 594
23*27 = 621
24*27 = 648
25*27 = 675
26*27 = 702
27*27 = 729
28*27 = 756
29*27 = 783
0*28 = 0
1*28 = 28
2*28 = 56
3*28 = 84
4*28 = 112
5*28 = 140
6*28 = 168
7*28 = 196
8*28 = 224
9*28 = 252
10*28 = 280
11*28 = 308
12*28 = 336
13*28 = 364
14*28 = 392
15*28 = 420
16*28 = 448
17*28 = 476
18*28 = 504
19*28 = 532
20*28 = 560
21*28 = 588
22*28 = 616
23*28 = 644
24*28 = 672
25*28 = 700
26*28 = 728
27*28 = 756
28*28 = 784
29*28 = 812
0*29 = 0
1*29 = 29
2*29 = 58
3*29 = 87
4*29 = 116
5*29 = 145
6*29 = 174
7*29 = 203
8*29 = 232
9*29 = 261
10*29 = 290
11*29 = 319
12*29 = 348
13*29 = 377
14*29 = 406
15*29 = 435
16*29 = 464
17*29 = 493
18*29 = 522
19*29 = 551
20*29 = 580
21*29 = 609
22*29 = 638
23*29 = 667
24*29 = 696
25*29 = 725
26*29 = 754
27*29 = 783
28*29 = 812
29*29 = 841
kaya-0.4.4/tests/test009/run 0000644 0001751 0001751 00000000252 11170340767 013656 0 ustar cim cim #!/bin/bash
../../compiler/kayac test009.k -L ../../rts -L ../../stdlib -o test009
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../rts/
./test009
rm -f test009 test009.exe
kaya-0.4.4/tests/test014/ 0000755 0001751 0001751 00000000000 11170340767 013124 5 ustar cim cim kaya-0.4.4/tests/test014/test014.k 0000644 0001751 0001751 00000000424 11170340766 014503 0 ustar cim cim program testrefs; //-*-C-*-ish
Void inc(var Int x)
{
x=x+1;
}
Void set(var [a] xs, Int i, a val)
{
xs[i]=val;
}
Void main()
{
y=6;
foo = ["Fish","Chips","Mushy Peas"];
inc(y);
set(foo,2,"Vinegar");
putStrLn(String(y));
putStrLn(foo[2]);
}
kaya-0.4.4/tests/test014/expected 0000644 0001751 0001751 00000000045 11170340767 014647 0 ustar cim cim Compiling program testrefs
7
Vinegar
kaya-0.4.4/tests/test014/run 0000644 0001751 0001751 00000000252 11170340767 013652 0 ustar cim cim #!/bin/bash
../../compiler/kayac test014.k -L ../../rts -L ../../stdlib -o test014
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../rts/
./test014
rm -f test014 test014.exe
kaya-0.4.4/tests/Makefile 0000644 0001751 0001751 00000000206 11170340770 013350 0 ustar cim cim test:
perl ./runtest.pl all
update:
perl ./runtest.pl all -u
diff:
perl ./runtest.pl all -d
distclean:
rm -f *~
rm -f */output kaya-0.4.4/tests/libtests/ 0000755 0001751 0001751 00000000000 11170340766 013550 5 ustar cim cim kaya-0.4.4/tests/libtests/Makefile 0000644 0001751 0001751 00000000366 11170340766 015215 0 ustar cim cim KAYAC = ../../compiler/kayac
KAYAINC = -I../../rts
KAYALIB = -L ../../rts -L ../../stdlib
test: runtests
runtests: .PHONY # always build it
${KAYAC} runtests.k -force ${KAYAINC} ${KAYALIB}
./runtests
clean:
rm -f *.o *.ki runtests
.PHONY:
kaya-0.4.4/tests/libtests/preludetest.k 0000644 0001751 0001751 00000002265 11170340766 016271 0 ustar cim cim module preludetest;
// tests for the prelude and basic language features.
import Testing;
// Some basic conversion tests
public Void coerce {
x = randomInt;
assert(Int(String(x)) == x, "Int coercion "+x+" -> " +String(x));
x2 = randomFloat;
// Some error allowance needed!
y2 = Float(String(x2));
assert((y2-x2)<0.0000001 || (x2-y2)<0.0000001,
"Float coercion "+x2+" -> " +String(x2));
x3 = randomString();
y3 = string(array(x3));
assert(x3 == y3, "String/array coercion "+x3);
}
// Properties of prelude functions
public Void rev {
xs = randomIntArray();
ys = copy(xs);
reverse(ys);
if (size(xs)>0) {
assert(xs[0] == ys[size(ys)-1]);
}
reverse(ys);
assert(xs == ys);
}
public Void testRep {
foo = randomString();
assert(length(rep(foo,5))==length(foo)*5);
}
public Void testSort {
xs = [1..(1000+rand()%2000)];
ys = copy(xs);
shuffle(xs);
sort(xs);
assert(xs == ys);
}
public Void testRange {
assert([1..10] == [1,2,3,4,5,6,7,8,9,10]);
assert([1,3..10] == [1,3,5,7,9]);
assert([1,3..11] == [1,3,5,7,9,11]);
assert([10,9..1] == [10,9,8,7,6,5,4,3,2,1]);
assert([10..1] == []);
}
kaya-0.4.4/tests/libtests/closuretest.k 0000644 0001751 0001751 00000001421 11170340766 016276 0 ustar cim cim module closuretest;
// tests for closures and functional programming features
import Testing;
globals {
Int glob1; // for testing (a) globals, and (b) side-effecting closures.
}
public Void closure1 {
sc = 2; // Check scoping
xs = map(lambda(x) -> { x*sc }, [1..5]);
assert(xs == [2,4,6,8,10]);
}
Void rep(Void() fn, Int times)
{
for x in [1..times] {
fn();
}
}
public Void closure2 {
glob1 = 0;
rep(lambda() {
glob1 += 2;
}, 100);
assert(glob1 == 200);
}
Int runMarshalled(String function) {
Int(Int,Int) realfn = unmarshal(function,888);
return realfn(5,32);
}
public Void marshalClosure {
z = 5;
plus = lambda(Int x,Int y) -> { x+y+z };
plusm = marshal(plus,888);
assert(runMarshalled(plusm) == 42);
}
kaya-0.4.4/tests/libtests/runtests.k 0000644 0001751 0001751 00000001353 11170340766 015615 0 ustar cim cim program runtests;
// Unit testing framework for kaya standard libraries. Since the compilar
// and run-time system have to work for these to even run, we don't have
// tests for the particularly basic features.
// Separate tests are required to cover compiler errors.
import Testing;
import System;
import preludetest;
import closuretest;
Void main()
{
Testing::init();
// Prelude tests
add(@coerce, 100, "coercions");
add(@rev, 100, "reverse");
add(@testRep, 100, "rep");
add(@testSort, 100, "sort");
add(@testRange, 1, "range");
// Closures
add(@closure1, 1, "closure1");
add(@closure2, 1, "closure2");
add(@marshalClosure, 1, "marshal closures");
if (!Testing::run()) {
exit(1);
}
}
kaya-0.4.4/tests/test008/ 0000755 0001751 0001751 00000000000 11170340767 013127 5 ustar cim cim kaya-0.4.4/tests/test008/test008.k 0000644 0001751 0001751 00000001546 11170340766 014517 0 ustar cim cim program pair; // -*-C-*-ish
data AnotherPair = Pair2(a snd, b fst);
Void printPair((Int,Int) x)
{
putStr("("+String(x.fst)+","+String(x.snd)+")\n");
newpair = Pair2(x.fst,x.snd);
putStr( "("+String(newpair.fst)+","+String(newpair.snd)+")\n");
}
// Too easy - let's scare it a bit with an array of pairs.
[(Int,[String])] mkPairs(Int x) {
for(i=0;i