[antlr-interest] Beginner needing help with rewrite rules

Yves Weißig weissig at rbg.informatik.tu-darmstadt.de
Tue Oct 18 00:10:39 PDT 2011


Hi ANTLR list,
I'm using ANTLR within my master's thesis in order to parse the RTF file
format. Everything is fine so far, I can parse simple RTF documents. The
next step is to generate an AST. Here is where the problems start, it
seems as if I have an error in one of my rewrite-rules. If you look at
the grammar, what I want to do, is nest the groups. This means, a
"group" is child of a "group" if the subrule group in the rule group is
called: sg=group space* -> ^(GROUP $sg+). Maybe you try the grammar
using a simple RTF snippet, e.g.
  {\pard\fs32\b NOTES\par}
  {\pard\fs26 Recently I skimmed {\i Structure and Interpretation of
   Computer Programs}, by Sussman and Abelson, and I think there should
   have been more pictures.
  \line I like pictures.  Is that so na\'efve?
  \par}
from: http://search.cpan.org/~sburke/RTF-Writer/lib/RTF/Cookbook.pod
Do you have any comments or ideas what I'm doing wrong?
Best regards, Yves
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RtfParser.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20111018/3e62d5bf/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RtfLexer.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20111018/3e62d5bf/attachment-0001.pl 


More information about the antlr-interest mailing list