The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Re: [idea] troff -Troff
@ 2024-02-17 22:52 Douglas McIlroy
  2024-02-19 13:53 ` Marty McGowan, MIT Club of Princeton
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas McIlroy @ 2024-02-17 22:52 UTC (permalink / raw)
  To: TUHS main list

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]

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 #2: Type: text/html, Size: 1337 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [TUHS] Re: [idea] troff -Troff
  2024-02-17 22:52 [TUHS] Re: [idea] troff -Troff Douglas McIlroy
@ 2024-02-19 13:53 ` Marty McGowan, MIT Club of Princeton
  0 siblings, 0 replies; 3+ messages in thread
From: Marty McGowan, MIT Club of Princeton @ 2024-02-19 13:53 UTC (permalink / raw)
  To: Pete Wright

[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]

I don't know if it's an AST, but I think pandoc ( https://pandoc.org/MANUAL.html ) comes close to the practical tool.   I use it to translate HTML to Markdown, which I now prefer to OrgMode.

=*+[]* Marty McGowan        +1 908 230-3739
VP of Membership, MIT Club of Princeton <https://alumcommunity.mit.edu/topics/23427/memberships>
 <https://alumcommunity.mit.edu/topics/23427/memberships>






On Sat, Feb 17, 2024, at 17:52, 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 #2: Type: text/html, Size: 3376 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [TUHS] Re: [idea] troff -Troff
@ 2024-02-18 14:43 Douglas McIlroy
  0 siblings, 0 replies; 3+ messages in thread
From: Douglas McIlroy @ 2024-02-18 14:43 UTC (permalink / raw)
  To: TUHS main list

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

Apologies for posting the above title tonTUHS. It's not the first time that
I've crossed signals between groff and TUHS, but hey, I've got 10 years on
Biden.

Doug

[-- Attachment #2: Type: text/html, Size: 221 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-19 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-17 22:52 [TUHS] Re: [idea] troff -Troff Douglas McIlroy
2024-02-19 13:53 ` Marty McGowan, MIT Club of Princeton
2024-02-18 14:43 Douglas McIlroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).