簡體   English   中英

ParseKit的Propostional Logic Grammar

[英]Propostional Logic Grammar for ParseKit

我正在嘗試為Parsekit寫一個語法,用於我的iphone應用程序。 我這樣做了嗎?

@start = wff;

wff = disjunction ('IMPLIES' | disjunction);
disjunction = conjunction ('OR' | conjunction)*;
conjunction = notexpression ('AND' | notexpression)*'
notexpression = ('NOT')+ primaryexpression;
primaryexpression = (literal | '(' wff ')');
literal = (A | B | C | D | E | F | G | H | I | J | K | L | M | N |O | P | Q | R | S | T |         U | V | W | X | Y | Z);

我收到錯誤:

2012-11-26 10:41:06.348 SemanticTab[4092:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not build ClassName from token array for parserName: conjunction'
*** First throw call stack: 

在嘗試解析P OR Q時?

這里是ParseKit的開發者。

我看到兩個明顯的問題:

  1. 具有conjunction生產定義的行以' (單引號)終止。 那應該是一個; (半結腸)。

  2. literal作品的定義無效。 沒有定義名為ABC等的產品。 但是,如果我理解您的意圖,更簡單的定義literal是使用內置的Word制作:

    literal = Word;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM