@fink/larix
Version:
A parser for generating fink's AST.
14 lines • 841 B
JavaScript
import { add_operator } from "@fink/prattler/expressions.js";
import { prefix, infix, infix_right } from "../expressions.js";
export const arithm = token_type => infix(token_type, `arithm`);
export const arithm_right = token_type => infix_right(token_type, `arithm:right`);
export const add_arithmetic_operators = ctx => {
let ˆpipe_result_1 = ctx;
ˆpipe_result_1 = add_operator(arithm(`+`))(ˆpipe_result_1);
ˆpipe_result_1 = add_operator(arithm(`-`))(ˆpipe_result_1);
ˆpipe_result_1 = add_operator(prefix(`prefix_neg`, `arithm:prefix`))(ˆpipe_result_1);
ˆpipe_result_1 = add_operator(arithm(`*`))(ˆpipe_result_1);
ˆpipe_result_1 = add_operator(arithm(`/`))(ˆpipe_result_1);
ˆpipe_result_1 = add_operator(arithm(`%`))(ˆpipe_result_1);
return ˆpipe_result_1 = add_operator(arithm_right(`^`))(ˆpipe_result_1);
};