0

我有一个语法(包括在下面,但其他示例也一样),我通过 ParserGenApp 运行并在我的应用程序中使用生成的类。它失败并出现以下错误:

  Expected : }
  Line : 3
  Near : start - > 
  Found : start

但是,在同一个应用程序中,调用

PKParser   *parser = [[PKParserFactory factory] parserFromGrammar:bnr assembler:self error:&error];
PKAssembly *result = [parser parse:input error:&error];

工作得很好。

语法是:

start              = graph;
graph              = strictOrEmpty graphType id '{' stmtList* '}';
strictOrEmpty      = 'strict' | Empty;
graphType          = 'digraph' | 'graph';
stmtList           = stmt (';' stmtList)* ;
stmt               = nodeDefinition | edgeDefinition;
id                 = Word;

nodeDefinition     = id '[' nodeAttributes ']';
nodeAttributes     = nodeAttribute (',' nodeAttributes)* ;
nodeAttribute      = nodeAttributeKey '=' nodeAttributeValue;
nodeAttributeKey   = Word;
nodeAttributeValue = Word;

edgeDefinition     = id edgeLinkSymbol id;
edgeLinkSymbol     = '->';
4

0 回答 0