[antlr-interest] Syntactic Predicate with Tree Grammar

Fred phreed at gmail.com
Thu Feb 14 11:50:05 PST 2008


Given an AST as follows...
<A>
  <B>
    <C>
      <E>
        <F>
    <D>
      <F>

...or expanded into a node list {where '(' means DOWN and ')' means UP}...

A ( B ( C ( E ( F ) ) D ( F ) ) )

...and a tree grammar (fragment)...

expr
  : (^(B ^(C .) .))=>
    ^(B ^(C a1=.) b1=.) -> doX()
  | ^(B a2=. b2=.) -> doY()
  ;

...I get an error like...

A.g: node from after line ..:.. no viable alternative at input 'UP'

...where the line number corresponds to the C node.


More information about the antlr-interest mailing list