/** Parser for Assignment 1 */ import java.io._ import java.util._ import scala.collection.mutable.ArrayBuffer class Parser(in: Lexer) { /** Convenience constructor that takes a Reader as input */ def this(inputStream: Reader) { this(new Lexer(inputStream)) } def this(fileName: String) { this(new FileReader(fileName)) } def lexer():Lexer = in /** Parses the program text in the lexer bound to 'in' and returns the corresponding AST. * @throws ParseException if a syntax error is encountered (including lexical errors). */ def parse():AST = { /* YOUR CODE GOES HERE */ } /** Parses: * :: = if then else * | let in * | map to * | { } */ private def parseExp():AST = { /* YOUR CODE GOES HERE */ } /* CODE HERE FOR PARSE METHODS FOR OTHER SYNTACTIC CATEGORIES (E.G., TERM) }