comparison testc.rhope @ 19:90c20dc3f4e5

Initial work on compiling dataflow graphs to a backend
author Mike Pavone <pavone@retrodev.com>
date Wed, 27 May 2009 21:29:15 +0000
parents ea991f95ae1f
children
comparison
equal deleted inserted replaced
18:ea991f95ae1f 19:90c20dc3f4e5
1 Import cbackend.rhope 1 Import cbackend.rhope
2 2
3 Main[] 3 Main[]
4 { 4 {
5 base <- [[[[[[C Function["Fib",("n"),("out"),""] 5 prog <- C Program[]
6 base <- [[[[[[[prog]Create Function["Fib",("n"),("out"),""]
6 ]Allocate Var["work1", "Any Type"] 7 ]Allocate Var["work1", "Any Type"]
7 ]Allocate Var["work2", "Any Type"] 8 ]Allocate Var["work2", "Any Type"]
8 ]Null["out"] 9 ]Null["out"]
9 ]Method Call["<", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_2"]]]] 10 ]Method Call["<", [[()]Append[AddRef["n"]]]Append[AddRef[Constant["const_2"]]]]
10 ]Move[Result[0], "work1"] 11 ]Move[Result[0], "work1"]
36 func <- [[[base 37 func <- [[[base
37 ]Do If[Result[0], stream1] 38 ]Do If[Result[0], stream1]
38 ]Do If[Result[1], stream2] 39 ]Do If[Result[1], stream2]
39 ]Release["n"] 40 ]Release["n"]
40 {Print["func done"] } 41 {Print["func done"] }
42
43 Print[[[prog]Store Function[func]]Text]
41 44
42 Print[[func]Definitions]
43 {
44 Print[[func]Text] }
45 } 45 }
46 46
47 Foo[]
48 {
49 }
50