From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from minnie.tuhs.org (minnie.tuhs.org [50.116.15.146]) by inbox.vuxu.org (Postfix) with ESMTP id 50F6629FD4 for ; Mon, 19 Feb 2024 14:54:49 +0100 (CET) Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id B248543174; Mon, 19 Feb 2024 23:54:43 +1000 (AEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by minnie.tuhs.org (Postfix) with ESMTPS id 6EDB9430FB for ; Mon, 19 Feb 2024 23:54:29 +1000 (AEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 835E85C004E for ; Mon, 19 Feb 2024 08:54:28 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute3.internal (MEProxy); Mon, 19 Feb 2024 08:54:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to :reply-to:subject:subject:to:to; s=fm1; t=1708350868; x= 1708437268; bh=5feRpSVdeXquFLmDmvizTxNK4640naTht5Fsn74NIP8=; b=d 91gBPxhQSD+mavfmIiFN67BQl7HcW0lpAIs38KwhCnnHuhE+EQjjoLAniC/Y5f78 cYIYWZzWAnqY+VyOT00i+B7dFDzlUs3/VXwxV1PJ8ZVkqm6WowHCLIAQwMyVZiNj vJweDysqzCTT25Llm7Orkew+GOIcpLyN4NnXJXf/cJsRQpSZmbqAnAcF0m4hdlc+ bRv0mDJN5KN990sHhfv67jg5pDfp9lFtmTkSVzOEHYWBmzNfMiMJbPKpBRYvAkmA PLjG8tTXbRy9sTQ+1vC096e7YNFOIG43BJyMd4OX2Tvsg1sqsfEQSe9JdXfMM8Qd KBY9BGYH/ALhruIvL5Y0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1708350868; x=1708437268; bh=5feRpSVdeXquF LmDmvizTxNK4640naTht5Fsn74NIP8=; b=o5vuI8p6cqF/0lJOKyKmfQRjJwlR6 56Tur3i8EDCYBrdjNYzmJehiGGLp0pvYK4wGdoqDU7o2Pxxa2/u+PphDFU1IXUNO bJNcjA6viw5Z+hA8C2lDBZQx0+9Y+pV6aNSgIb2+uDzarirtNhemAUPF2T/nARCD MpnlwgsultgqLClkh3pJ3B5qtabbV+Wn2ioD0C21DOVOjFsfNs3Ltn88n0Ji+w9A rjKA2lo+gUVnGpTo4UXp0fLBKmfm5T4d3jV64NaafJTVOrMFfQtT+LOTjnR4AA2F Erxb/gCS5XW3xugJ/SCGzF1m8MoRBaB2DFnoJZ16xEUtYQMrm2qWp/mag== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdekgdehjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhrhfvufgtsegrtd erreerredtnecuhfhrohhmpedfofgrrhhthicuofgtifhofigrnhdpucfokffvucevlhhu sgcuohhfucfrrhhinhgtvghtohhnfdcuoehmrghrthihmhgtghesfhgrshhtmhgrihhlrd gtohhmqeenucggtffrrghtthgvrhhnpeevjedtvddvfeeukeejjeeileegleejkefhgedv fefhjeekvedtudduhfdvieeiffenucffohhmrghinhepphgrnhguohgtrdhorhhgpdhmih htrdgvughunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhgrrhhthihmtghgsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i2d9949cd:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 40DF82A20092; Mon, 19 Feb 2024 08:54:28 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 MIME-Version: 1.0 Message-Id: <3380a2a1-bf68-4cbe-99ba-bf74d88905e3@app.fastmail.com> In-Reply-To: References: Date: Mon, 19 Feb 2024 08:53:30 -0500 From: "Marty McGowan, MIT Club of Princeton" To: "Pete Wright" Content-Type: multipart/alternative; boundary=4bb30945212d464e82c3576e2a17e973 Message-ID-Hash: E3AC2ISDLJAMDFFAWZXNHUGOALCPGKTD X-Message-ID-Hash: E3AC2ISDLJAMDFFAWZXNHUGOALCPGKTD X-MailFrom: martymcg@fastmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Reply-To: martymcgowan@alum.mit.edu Subject: [TUHS] Re: [idea] troff -Troff List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --4bb30945212d464e82c3576e2a17e973 Content-Type: text/plain 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 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 --4bb30945212d464e82c3576e2a17e973 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
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 pr= efer to OrgMode.

=3D*+[]* Marty McGowan  &nb= sp;     +1 908 230-3739






On Sat, Feb 17, 2= 024, at 17:52, Douglas McIlroy wrote:
To expand on Branden's obser= vation that translating from one member of the roff family to anoth= er is hard, I note that the final output usually presents a text in a sh= ape 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.
<= /div>

Translation involves parsing input into an AST = according to one grammar and unparsing  to generate output accordin= g to another. Chomsky's work uses transformational grammars primarily fo= r generation. I'm not aware of any implementation of the inverse: parsin= g according to a transformational grammar. Certainly no practical tools = exist for doing so.

Unfortunately, one does= n'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 str= ictly defined programming language. So, the absence of formal tools is e= xacerbated. Roff scripts, like everyday English, are written according t= o an intuitive--and occasionally ad hoc--grammar that varies both with a= uthors and with time. And seventy years of hard work has not yet fully a= utomated the parsing of English.

Doug

--4bb30945212d464e82c3576e2a17e973--