|
Scala example source code file (Main.scala)
The Scala Main.scala source codepackage examples.parsing.lambda import scala.util.parsing.combinator.Parsers import scala.util.parsing.input.StreamReader import java.io.File import java.io.FileInputStream import java.io.InputStreamReader /** * Parser for an untyped lambda calculus * * Usage: scala examples.parsing.lambda.Main <file> * * (example files: see test/ *.kwi) * * @author Miles Sabin (adapted slightly by Adriaan Moors) */ object Main extends Application with TestParser { override def main(args: Array[String]) = { val in = StreamReader(new InputStreamReader(new FileInputStream(new File(args(0))), "ISO-8859-1")) parse(in) match { case Success(term, _) => { Console.println("Term: \n"+term) } case Failure(msg, remainder) => Console.println("Failure: "+msg+"\n"+"Remainder: \n"+remainder.pos.longString) case Error(msg, remainder) => Console.println("Error: "+msg+"\n"+"Remainder: \n"+remainder.pos.longString) } } } Other Scala examples (source code examples)Here is a short list of links related to this Scala Main.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.