You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/src/main/java/chocopy/pa1/StudentParser.java

26 lines
628 B

package chocopy.pa1;
import chocopy.common.astnodes.Program;
import java_cup.runtime.ComplexSymbolFactory;
import java.io.StringReader;
/**
* Interface between driver and parser.
*/
public class StudentParser {
/**
* Return the Program AST resulting from parsing INPUT. Turn on
* parser debugging iff DEBUG.
*/
public static Program process(String input, boolean debug) {
ChocoPyLexer lexer = new ChocoPyLexer(new StringReader(input));
ChocoPyParser parser =
new ChocoPyParser(lexer, new ComplexSymbolFactory());
return parser.parseProgram(debug);
}
}