comparison kernelbase.rhope @ 136:fc3815b7462f

Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
author Mike Pavone <pavone@retrodev.com>
date Sun, 14 Nov 2010 23:07:55 -0500
parents
children
comparison
equal deleted inserted replaced
135:18a4403fe576 136:fc3815b7462f
1
2 Val[in:out]
3 {
4 out <- in
5 }
6
7 Blueprint Int32
8 {
9 Num(Int32,Naked)
10 }
11
12 If@Int32[num:yes,no]
13 {
14 yes,no <- If[[num]!=[0i32]]
15 }
16
17 Trunc UInt8@UInt8[in:out]
18 {
19 out <- in
20 }
21
22 Blueprint UInt32
23 {
24 Num(UInt32,Naked)
25 }
26
27 If@UInt32[num:yes,no]
28 {
29 yes,no <- If[[num]!=[0u32]]
30 }
31
32 Blueprint UInt8
33 {
34 Num(UInt8,Naked)
35 }
36
37 If@UInt8[num:yes,no]
38 {
39 yes,no <- If[[num]!=[0u8]]
40 }
41
42 Abs@Int32[num:out]
43 {
44 If[[num]<[0i32]]
45 { out <- [0i32]-[num] }
46 { out <- num }
47 }
48
49 Mod[a,b:out]
50 {
51 out <- [a]-[[[a]/[b]]*[b]]
52 }
53
54 And[left,right:out]
55 {
56 ,out <- If[left]
57 {
58 out,out <- If[right]
59 }
60 }
61
62 Or[left,right:out]
63 {
64 out <- If[left] {}
65 {
66 out <- right
67 }
68 }
69
70 Min[a,b:out]
71 {
72 If[[a]<[b]]
73 {
74 out <- a
75 }{
76 out <- b
77 }
78 }
79
80 Max[a,b:out]
81 {
82 If[[a]>[b]]
83 {
84 out <- a
85 }{
86 out <- b
87 }
88 }
89