fsyacc には、解析時に導入される演算子を処理する方法がありますか? LLVMチュートリアルの例として使用されるおもちゃの言語であるKaleidoscope用のパーサーを構築しようとしています。Kaleidoscope では、演算子を優先レベルとともに定義できます。例えば:
# Logical unary not.
def unary!(v)
if v then
0
else
1;
# Define > with the same precedence as <.
def binary> 10 (LHS RHS)
RHS < LHS;
# Binary "logical or", (note that it does not "short circuit")
def binary| 5 (LHS RHS)
if LHS then
1
else if RHS then
1
else
0;
# Define = with slightly lower precedence than relationals.
def binary= 9 (LHS RHS)
!(LHS < RHS | LHS > RHS);