Doug followed up on one of our groff threads over on the TUHS list.

Here it is.

At 2024-02-17T17:52:11-0500, Douglas McIlroy wrote:
> To expand on Branden's observation that translating from one member of the
> roff family to another is hard, I note that the final output usually
> presents a text in a shape that has been fine-tuned for appearance. In
> grammatic terms it might best be presented in transformational terms a la
> Chomsky: a basic text with a fairly simple grammar tweaked by
> pretty-printing transforms.
> 
> Translation involves parsing input into an AST according to one grammar and
> unparsing  to generate output according to another. Chomsky's work uses
> transformational grammars primarily for generation. I'm not aware of any
> implementation of the inverse: parsing according to a transformational
> grammar. Certainly no practical tools exist for doing so.
> 
> Unfortunately, one doesn't consciously write roff according to the model I
> have outlined. This means that parsing it is more like parsing a natural
> language than a strictly defined programming language. So, the absence of
> formal tools is exacerbated. Roff scripts, like everyday English, are
> written according to an intuitive--and occasionally ad hoc--grammar that
> varies both with authors and with time. And seventy years of hard work has
> not yet fully automated the parsing of English.
> 
> Doug

Attachment: signature.asc
Description: PGP signature

Reply via email to