我正在尝试为 ParseKit 编写语法,以便它匹配 iphone 应用程序中的基本命题逻辑句子。有人可以告诉我我哪里出错了。
@start = wff;
wff = disjunction (implies disjunction)?;
disjunction = conjuction (or conjuction)*;
conjunction = notExpression (and notExpression)*;
notExpression = (not | not primaryExpression);
primaryExpression = variable | lbracket wff rbracket;
variable = p | q | r;
p = 'P';
q = 'Q';
r = 'R';
implies = '→';
and = '∧';
or = '∨';
not = '¬';
lbracket = '(';
rbracket = ')';
另外,我将如何添加一些额外的回调,以便我可以从语法中创建解析树。