fsyacc是否有辦法處理在解析時引入的運算符?我正在嘗試爲萬花筒打造一個解析器,這是一個玩具語言,用作LLVM tutorial的示例。萬花筒允許運營商與優先級一起定義。例如: # Logical unary not.
def unary!(v)
if v then
0
else
1;
# Define > with the same precede
我使用F#Power Pack中的fsyacc/fslex來解析某些源代碼。 爲了檢測我用下面的代碼中的錯誤: use inputChannel = new StreamReader(File.OpenRead tempFileName)
let lexbuf = Lexing.LexBuffer<_>.FromTextReader inputChannel
let ast = try
我需要解析簡單的DSL語言類似如下: import "library.txt"
def <int, bool, byte> main(int param1, bool param2)
{
var a = f4(param1); // or var d = f1(f2(f3(f4(param1))));
var b = f3(a);
var c = f2(b);
我開始玩Fslex/Fsyacc。當嘗試使用該輸入 Parser.fsy生成解析器: %{
open Ast
%}
// The start token becomes a parser function in the compiled code:
%start start
// These are the terminal tokens of the grammar along w