diff -r c0d9e6548b08 -r a1dc57326356 solutions5/bf.scala --- a/solutions5/bf.scala Tue Aug 25 01:18:17 2020 +0100 +++ b/solutions5/bf.scala Tue Aug 25 01:41:56 2020 +0100 @@ -1,20 +1,22 @@ -// Part 1 about an Interpreter for the Brainf***++ language -//======================================================== - +// Core Part about an Interpreter for +// the Brainf***++ language +//============================================== object CW10a { -import io.Source -import scala.util._ +// representation of Bf memory type Mem = Map[Int, Int] // (1) Write a function that takes a file name as argument and -// and requests the corresponding file from disk. It returns the +// and requests the corresponding file from disk. It Returns the // content of the file as a String. If the file does not exists, -// the function should return the empty string. +// the function should Return the empty string. + +import io.Source +import scala.util._ def load_bff(name: String) : String = Try(Source.fromFile(name)("ISO-8859-1").mkString).getOrElse("") @@ -82,6 +84,7 @@ // rules of the brainf***++ language. Then, recursively, the compute // function continues with the command at the new program // counter. +// // Implement the run function that calls compute with the program // counter and memory counter set to 0.