Skip to content

Instantly share code, notes, and snippets.

@WaseemTheDream
Created September 29, 2013 21:41
Show Gist options
  • Save WaseemTheDream/6756839 to your computer and use it in GitHub Desktop.
Save WaseemTheDream/6756839 to your computer and use it in GitHub Desktop.
import scala.io.Source
object lab1 {
def main(args: Array[String]) {
val argsInstruction = "Please provide the following 3 arguments: \n" +
"\t1. a flag t or b for top down or bottom up allocator respectively\n" +
"\t2. an integer >= 2 which specifies the number of registers to use\n" +
"\t3. an input file name"
if (args.length != 3)
throw new Error("Invalid number of arguments. " + argsInstruction)
val flag = args(0)
val k = Integer.parseInt(args(1), 10)
val input = args(2)
// if (flag != 't' || flag != 'b') throw new Error("Arg 1 invalid. " + argsInstruction)
// if (k < 2) throw new Error("Arg 2 invalid. " + argsInstruction)
println(flag)
println(k)
println(input)
for (arg <- args) println(arg)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment