[antlr-interest] Re: RTF spec/grammar in (E)BNF

lgcraymer lgc at mail1.jpl.nasa.gov
Tue Oct 29 17:25:33 PST 2002


My grammar is pretty ancient (vsn 1.3 of the spec--the current vsn is 
1.6) and it took heavy advantage of the RTF backwards compatibility 
design policy "if you don't recognize it, ignore it".  I didn't need 
to parse headers so I ignored them; I just needed to recognize 
critical parts of the document.

If you look at the Microsoft RTF spec at 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtf
spec/html/rtfspec.asp, you will find that there is a complete EBNF 
spec in the document.  To get at it, you will have to download each 
section separately (or so it appears).  (I got the earlier version in 
doc format before they put it in HTML and made it impossible to 
download all at once).

One useful trick:  I wrote a simple language to build a table of RTF 
commands which associated a processing type with each command.  That 
helped considerably to reduce the size of the lexer and parser 
grammars.

--Loring


--- In antlr-interest at y..., Terence Parr <parrt at j...> wrote:
> 
> On Monday, October 28, 2002, at 09:05  PM, Spenser Kao wrote:
> 
> > Hi,
> >
> >  
> >
> > I wonder if there is a showcase of implementing a RTF (Rich Text 
> > Format) reader in ANTLR.
> >
> > The core part of the job is to express RTF spec/grammar in (E)BNF, 
has 
> > any one done that before?
> 
> Loring at NASA may be able to release his old PCCTS RTF grammar.  
> Loring?
> 
> Ter
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list