123456789101112131415161718192021222324252627282930313233343536373839 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>Test Page</title>
- <script type="text/javascript" src="build/dev/runtime.js"></script>
- <script type="text/javascript">
- /*
- Object.assign(window, KumaChan)
- var_declare = (scope, name, value) => KumaChan.var_declare(scope)(name,value)
- var_assign = (scope, name, value) => KumaChan.var_assign(scope)(name,value)
- var_lookup = (scope, name) => KumaChan.var_lookup(scope)(name)
- let f = fun('local f (Int x, Int y) -> Int', (x,y) => x+y)
- console.log(f(1,2))
- let F = sig([G.Int, G.Int], G.Int)
- console.log(is(f,F))
- let g = fun('local f(List &x, Int y) -> Void', (x,y) => (x.push(y),G.Void) )
- console.log(is(g, sig([G.List, G.String], G.Void)))
- console.log(g([],1))
- let A = create_class('A', [], fun('local init() -> Any', s=>var_declare(s,'abc',123)), { m1: fun('local m1() -> Int', s=>s.lookup('abc')) })
- console.log(A.create())
- let I1 = create_interface('I1',{m1:sig([],G.Int),m2:fun('local m2 () -> Int', s=> { return (s.lookup('m1'))()*2 + 1 } )})
- let C = create_class('C', [I1], fun('local init() -> Any', s=>var_declare(s,'def',4567)), { m1: fun('local m1() -> Int', s=>var_lookup(s,'def')) })
- console.log(call_method(Global,call(C,[]),'m2',[]))
- let I = create_interface('I',{q:sig([],G.String)})
- let D = create_class('D', [I], fun('local init() -> Any', s=>var_declare(s,'uv','gergveriner')), { q: fun('local q() -> String', s=>var_lookup(s,'uv')+'cfergv') })
- let X = create_class('X',[D,I],fun('local init() -> Any',(s,expose)=> { let d = D.create(); expose(d); } ), { v: fun('local v () -> Int', s=>999) } )
- let x = call(X,[])
- console.log(x)
- console.log(call_method(Global,x,'v',[]), x.methods.q())
- */
- </script>
- </head>
- <body>
- <h1>我能吞下玻璃而不傷身體</h1>
- <p>KumaChan Programming Language (Refactor Version)</p>
- </body>
- </html>
|