[antlr-interest] [bug?] @after block vs end-of-rule block (C runtime)

David Benn david.benn at astc-design.com
Tue Jun 10 20:27:29 PDT 2008


In ANTLR 3.1b1 with the C runtime, in a tree grammar I have this:

st_def     
scope {
    STEntry* entry;
}
    :
      (type IDENT
      {
          $st_def::entry = symtab->CreateSTEntry($type.text->chars,
                $IDENT.text->chars);
      }

      st_spec?)
      {
          symtab->AddSTEntry($st_def::entry);
      }
    ;

which works fine. I would have thought that an @after block would also 
work in this case

st_def     
scope {
    STEntry* entry;
}
@after {
     symtab->AddSTEntry($st_def::entry);
}
    :
      (type IDENT
      {
          $st_def::entry = symtab->CreateSTEntry($type.text->chars,
                $IDENT.text->chars);
      }

      st_spec?)
    ;

but it doesn't. I get a seg fault under Linux.

Is this because the st_def scope has gone away by the time the @after 
block is called, or is this a bug in the C runtime?

Thanks.

Regards,

David

-- 
David Benn
Australian Semiconductor Technology Company (ASTC) Pty Ltd
76 Waymouth Street
Adelaide 5000, South Australia
ABN:   18 117 392 784
Tel:   +61 8 8231 2782
Mob:   +61 407 261163
Email: david.benn at astc-design.com
Web:   www.astc-design.com



More information about the antlr-interest mailing list