equal
deleted
inserted
replaced
1 // Part 1 about an Interpreter for the Brainf*** language |
1 // Part 1 about an Interpreter for the Brainf*** language |
2 //======================================================== |
2 //======================================================== |
3 |
3 |
4 object CW10a { // only for generating the Jar file |
4 //object CW10a { // only for generating the Jar file |
5 |
5 |
6 |
6 |
7 type Mem = Map[Int, Int] |
7 type Mem = Map[Int, Int] |
8 |
8 |
9 |
9 |
10 import io.Source |
10 import io.Source |
11 import scala.util._ |
11 import scala.util._ |
12 |
12 |
13 // (1) Write a function that takes a file name as argument and |
13 // (1) Write a function that takes a file name as argument and |
14 // and requests the corresponding file from disk. It returns the |
14 // and requests the corresponding file from disk. It Returns the |
15 // content of the file as a String. If the file does not exists, |
15 // content of the file as a String. If the file does not exists, |
16 // the function should return the empty string. |
16 // the function should Return the empty string. |
17 |
17 |
18 def load_bff(name: String) : String = |
18 def load_bff(name: String) : String = |
19 Try(Source.fromFile(name)("ISO-8859-1").mkString).getOrElse("") |
19 Try(Source.fromFile(name)("ISO-8859-1").mkString).getOrElse("") |
20 |
20 |
21 |
21 |
220 } |
220 } |
221 |
221 |
222 time_needed(1, run(b1)) |
222 time_needed(1, run(b1)) |
223 */ |
223 */ |
224 |
224 |
225 } |
225 //} |