078c1eecba
The parser expects the AST object to be mutable, which modules are not.
13 lines
280 B
JavaScript
13 lines
280 B
JavaScript
import parser from "./parser";
|
|
import AST from "./ast";
|
|
|
|
export { parser };
|
|
|
|
export function parse(input) {
|
|
// Just return if an already-compile AST was passed in.
|
|
if(input.constructor === AST.ProgramNode) { return input; }
|
|
|
|
parser.yy = AST;
|
|
return parser.parse(input);
|
|
}
|