Skip to content

Commit

Permalink
fixed main method
Browse files Browse the repository at this point in the history
  • Loading branch information
Frobeniusnorm committed Nov 30, 2021
1 parent dfffab4 commit 9a49d04
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/main/scala/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ def printHelp: Unit =

def readFile:String => Array[String] = name => Source.fromFile(name).getLines.toArray
@main
def main: Array[String] => Unit = args => args match
case Array() => printHelp
case x =>
//parse compiler options
if x.length == 1 then
val ast = new AST(readFile(x(0)))
val np = Parser.parseProgram(ast.program)
val interpreter = new Interpreter(np)
(ast.program.expr zip interpreter.evaledExpr) foreach (
(x, y) => println(x.toString + " = " + y.toString)
)
def main(file:String) =
val ast = new AST(readFile(file))
val np = Parser.parseProgram(ast.program)
val interpreter = new Interpreter(np)
(ast.program.expr zip interpreter.evaledExpr) foreach (
(x, y) => println(x.toString + " = " + y.toString)
)

0 comments on commit 9a49d04

Please sign in to comment.