import { assert } from "../../assert.js";
import { ReactivePegCompiler } from "./pegjs/ReactivePegCompiler.js";
import { ReactivePegParser } from "./pegjs/ReactivePegParser.js";

/**
 *
 * @param {string} code
 * @returns {ReactiveExpression}
 */
export function compileReactiveExpression(code) {
    assert.isString(code, 'code');

    const parseTree = ReactivePegParser.INSTANCE.parse(code);

    return ReactivePegCompiler.compile(parseTree);
}
