equal
deleted
inserted
replaced
242 case s::bl => eval_bl(bl, eval_stmt(s, env)) |
242 case s::bl => eval_bl(bl, eval_stmt(s, env)) |
243 } |
243 } |
244 |
244 |
245 def eval(bl: Block) : Env = eval_bl(bl, Map()) |
245 def eval(bl: Block) : Env = eval_bl(bl, Map()) |
246 |
246 |
|
247 |
|
248 //println(tokenise(os.read(os.pwd / "primes.while"))) |
|
249 |
|
250 //println(eval(Stmts.parse_all(tokenise(os.read(os.pwd / "primes.while"))).head)) |
|
251 |
|
252 |
|
253 |
247 @main |
254 @main |
248 def run(file: String) = { |
255 def run(file: String) = { |
249 val contents = os.read(os.pwd / file) |
256 val contents = os.read(os.pwd / file) |
250 println(s"Lex $file: ") |
257 println(s"Lex $file: ") |
251 println(tokenise(contents)) |
258 println(tokenise(contents)) |
265 } |
272 } |
266 |
273 |
267 /* |
274 /* |
268 println("Loops eval") |
275 println("Loops eval") |
269 val start = System.nanoTime() |
276 val start = System.nanoTime() |
270 println(eval(Stmts.parse_all(tokenise(os.read(os.pwd / "loops.while"))).head)) |
277 println(eval(Stmts.parse_all(tokenise(os.read(os.pwd / "primes.while"))).head)) |
271 val end = System.nanoTime() |
278 val end = System.nanoTime() |
272 println("Time taken in seconds: ") |
279 println("Time taken in seconds: ") |
273 println((end - start)/(1.0e9)) |
280 println((end - start)/(1.0e9)) |
274 */ |
281 */ |