equal
deleted
inserted
replaced
105 } |
105 } |
106 |
106 |
107 def run(prog: String, m: Mem = Map()) = compute(prog, 0, 0, m) |
107 def run(prog: String, m: Mem = Map()) = compute(prog, 0, 0, m) |
108 |
108 |
109 |
109 |
|
110 |
110 /* |
111 /* |
111 |
112 |
112 // some sample bf-programs collected from the Internet |
113 // some sample bf-programs collected from the Internet |
113 //===================================================== |
114 //===================================================== |
114 |
115 |
136 run("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++ |
137 run("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++ |
137 ..+++.>>.<-.<.+++.------.--------.>>+.>++.""") |
138 ..+++.>>.<-.<.+++.------.--------.>>+.>++.""") |
138 |
139 |
139 // hello world program 2 |
140 // hello world program 2 |
140 run("""++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>+ |
141 run("""++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>+ |
141 +.<<+++++++++++++++.>.+++.------.--------.>+.>.""") |
142 +.<<+++++++++++++++.>.+++.------.--------.>+.>.""") |
142 |
143 |
143 |
144 // hello world program 3 |
|
145 run("""+++++++++[>++++++++>+++++++++++>+++++<<<-]>.>++.+++++++.. |
|
146 +++.>-.------------.<++++++++.--------.+++.------.--------.>+.""") |
|
147 |
|
148 |
144 // draws the Sierpinski triangle |
149 // draws the Sierpinski triangle |
145 run("""++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[ |
150 run("""++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[ |
146 ->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<< |
151 ->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<< |
147 ]>.>+[>>]>+]""") |
152 ]>.>+[>>]>+]""") |
148 |
153 |