loom
1Тест работы IPC ====================================
2--- test/source/engine/debug/asynch-01.s-script :
3import "../import/asynch.s-script"
4: async
5
6def auto : factor = fn [factor] (int : x) -> int
7{
8if x <= 1 return 1
9
10return x*factor(x-1)
11}
12
13
14def auto : future = async.future( fn [factor] () { return factor(3) } )
15def int : f = factor(3)
16
17print f
18print f == future.get()
19--- interpret :
206
21true
22The work is stopped
23The work is completed
24--- test/source/engine/debug/divide-by-zero.s-script :
25fn div(int : x, int : y) -> int
26{
27return x/y
28}
29
30print div(4, 0)
31--- interpret :
32Ошибка: Произошло исключение при обработке оператора: {semantics : "", code : 64, param : "/"}
33Описание исключения: Деление на ноль
34Позиция разбора: test/source/engine/debug/divide-by-zero.s-script:3:13[3,14]
35Source: test/source/engine/debug/divide-by-zero.s-script
36[ 1]fn div(int : x, int : y) -> int
37[ 2]{
38[ 3] return x/y
39^
40[ 4]}
41[ 5]
42
43Calls:
440. fn div(int x, int y) -> int
45Called from (f:1, l:6, h:, o:4):
46Locals:
47y = 0
48x = 4
49
50<root module>
51Call point is out
52Locals:
53div = <function>
54
55The work is paused
56The work is completed
57--- test/source/engine/debug/fiber-01-primes-100.s-script :
58import "../import/primes.s-script" type Primes : p1
59
60make fiber p1
61flow fiber p1.prime(1,100)
62wait fiber p1
63--- interpret :
641
653
665
677
6811
6913
7017
7119
7223
7329
7431
7537
7641
7743
7847
7953
8059
8161
8267
8371
8473
8579
8683
8789
8897
89The work is stopped
90The work is completed
91