Minimal (?) protype-based language.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

156 regels
2.1 KiB

nil 42 3.140000 string Symbol newline
Object => <Object>
Lambda => <Lambda>
Closure => <Closure>
o = Object.new() => <<Object>>
o = Object.new(foo:42, bar: 666) => <<Object>>
| bar: 666
| foo: 42
o.foo => 42
Point.new() => <<Point>>
Point.new(x: 3, y: 4) => <<Point>>
| y: 4
| x: 3
twice 21 is 42
double => <closure>
Point.new(x:3, y:4).magnitude() => 5.000000
<<?>>
| self: nil =>
| self: nil
| n: 39
| 0: 40
40
<<?>>
| self: nil =>
| self: nil
| n: 40
| 0: 40
41
<<?>>
| self: nil =>
| self: nil
| n: 41
| 0: 40
42
<<?>>
| self: nil =>
| self: nil
| n: 42
| 0: 40
43
nil no
1 yes
hello yes
15
1973
42 42 42 42
ok
ok
42
----
MyType.__eval__() invoked
42
<closure>
====
42
hello
nil
<Undefined>
<Object>
nil
[KEY: __delegate__
KEY: y
KEY: x
]
Symbol
<Symbol>
<Object>
nil
POINT <Point>
P <<Object>>
P <<Point>>
Q <<Point>>
P.mag 13.000000
<<Object>>
| bar: 666
| foo: 42
| 0: 1
| 1: <<Object>>
| | 0: 2
| | 1: 3
| | 2: 42
[KEY: __delegate__
KEY: bar
KEY: foo
]
5
7
0
1
2
0
1
0: a
2
0: a
1: b
3
0: a
1: b
2: c
12
0: 104
1: 101
2: 108
3: 108
4: 111
5: 44
6: 32
7: 119
8: 111
9: 114
10: 108
11: 100
hello, world
hallo, world
hally, world
hally, wirld
READ = f() { print(__env__()) }
f();
0 30 t
<<Stream>>
f 102 ( 40 ) 41 32 { 123 32 p 112 r 114 i 105 n 110 t 116 ( 40 _ 95 _ 95 e 101 n 110 v 118 _ 95 _ 95 ( 40 ) 41 ) 41 32 } 125
10 f 102 ( 40 ) 41 ; 59
10
<<Binop>>
| operation: 15
| 0: 6
| 1: 7
42
42
6 * 7
MACRO table <<Object>>
| test: <closure>
define testfun
MACRO EVAL test with 1 and 2
MACRO EVAL test with three and four
call testfun
REPLACEMENT 1
REPLACEMENT three
0 1 2 3 4 5 6 7 8 9 10
10 9 8 7 6 5 4 3 2 1 0
0 1 2 3 4 5 6 7 8 9
65 66 67 68 69
1 two 3 four
11: n * factorial(n - 1)
10: if (n < 2) "1" else n * factorial(n - 1)
9: factorial(n - 1)
8: n * factorial(n - 1)
7: if (n < 2) "1" else n * factorial(n - 1)
6: factorial(n - 1)
5: n * factorial(n - 1)
4: if (n < 2) "1" else n * factorial(n - 1)
3: factorial(n - 1)
2: n * factorial(n - 1)
1: if (n < 2) "1" else n * factorial(n - 1)
0: factorial(5)