[antlr-interest] pushed antlr build with tree rewriting and composite grammars (java)

David Holroyd dave at badgers-in-foil.co.uk
Mon Jan 14 14:05:15 PST 2008


On Thu, Jan 10, 2008 at 04:39:54PM -0800, Terence Parr wrote:
> Grab
> 
> http://www.antlr.org/download/build/antlr-2008-01-10.16.tar.gz

Another change I notice is that where there were rules like,

  classDef
      :  CLASS ident
         classExtendsClause
         typeBlock
         -> (CLASS ident classExtendsClause typeBlock)

  classExtendsClause
      :  (EXTENDS^ identifier)?
      ;

I must change the rewrite in the first rule to,

  classDef
      :  CLASS ident
         classExtendsClause
         typeBlock
         -> (CLASS ident classExtendsClause? typeBlock)

Which sort-of makes sense, though the left and right hand sides of the
rewrite end up looking 'unbalanced' now.  It looks better if I just
hoist the '?' everywhere,

  classDef
      :  CLASS ident
         classExtendsClause?
         typeBlock
         -> (CLASS ident classExtendsClause? typeBlock)

  classExtendsClause
      :  EXTENDS^ identifier
      ;


ta,
dave

-- 
http://david.holroyd.me.uk/


More information about the antlr-interest mailing list