Re: Table-driven Parser

Detlef Meyer-Eltz <>
2 Oct 2005 02:54:16 -0400

          From comp.compilers

Related articles
Table-driven Parser (Cobus Kruger) (2005-09-30)
Re: Table-driven Parser (Paul Mann) (2005-10-02)
Re: Table-driven Parser (Dmitry A. Kazakov) (2005-10-02)
Re: Table-driven Parser (Detlef Meyer-Eltz) (2005-10-02)
Re: Table-driven Parser (Hans-Peter Diettrich) (2005-10-02)
| List of all articles for this month |

From: Detlef Meyer-Eltz <>
Newsgroups: comp.compilers
Date: 2 Oct 2005 02:54:16 -0400
Organization: Compilers Central
References: 05-09-142
Keywords: parse
Posted-Date: 02 Oct 2005 02:54:16 EDT

> I have been writing an RTF to PDF converter

> I read in Microsoft's documentation that most RTF parsers are table
> driven. To me that doesn't say much. I then downloaded their test app
> which has a horde of lines making up tables, but doesn't seem to do
> anything meaningful.

The problem of a RTF parser is the handling of unknown (new invented)
control words or control symbols. They should be ignored, and if they
are preceded by an opening brace, the whole group until the closing
brace should be ignored. This is what the Mircosoft example does
correcly. The disadvantage of the Mircosoft reader is, that any
context of the control words is lost.

> RTF never
> struck me as having enough of a structure to merit a real parser

RTF has an exactly specified grammar, whith a header/document
structure and rules, where informations on the same subject, e.g. font
or style attribute, follow one another in an ordered way. A RTF parser
would be much clearer, if it would treat these informations in this
ordered way too and the interaction with a pdf generator (I know at
least one commercial) would be simplified too. Such a parser could be
made by a parser generator, but these tools would have difficulties
with the problem mentioned above. And to make a complete parser would
be quite a lot of work, as many control words exist. The task could be
simplified by skipping some parts of the input according to the
requirements of your company. I think the best would be, to use a
parser generator for the construction of the parser and then use the
Microsoft reader as a scanner for this parser.


Detlef Meyer-Eltz


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.