LARA

package minijava
 
import java.io.{FileInputStream,IOException,ByteArrayInputStream}
 
object Main {
  def main(args: Array[String]) {
    val compUnit = new Compiler()
 
    var parsedTree: Option[parser.Trees.Tree] = None
 
    if (args.length != 1)
      compUnit.fatalError("usage: scala minijava.Main <File.java>")
    try {
      val in = new FileInputStream(args(0))
      parsedTree = Some(compUnit.parseInputStream(in))
      println(TreePrinter(parsedTree.get))
      in.close()
    } catch {
      case e: IOException => compUnit.fatalError(e.getMessage)
    }
    compUnit.terminateIfErrors
 
    // Comment out the rest of the program while you're implementing the parser + tree printer
    // You can use it as a test for your system once everything's in place.
    val compUnit2 = new Compiler()
    val progString = TreePrinter(parsedTree.get)
    val newStream = new ByteArrayInputStream(progString.getBytes())
    val tree2 = compUnit2.parseInputStream(newStream)
    val string2 = TreePrinter(tree2)
    assert(string2 equals progString)
  }
}