From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29719 invoked from network); 17 May 2020 00:00:02 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 17 May 2020 00:00:02 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id A7FE99C994; Sun, 17 May 2020 10:00:00 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id B89A19C5E4; Sun, 17 May 2020 09:59:40 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id E3F119C5E4; Sun, 17 May 2020 09:59:38 +1000 (AEST) Received: from fourwinds.com (fourwinds.com [63.64.179.162]) by minnie.tuhs.org (Postfix) with ESMTPS id 67E089C5E1 for ; Sun, 17 May 2020 09:59:38 +1000 (AEST) Received: from darkstar.fourwinds.com (localhost [127.0.0.1]) by fourwinds.com (8.15.2/8.15.2) with ESMTPS id 04GNxaBo3783014 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Sat, 16 May 2020 16:59:36 -0700 Received: from darkstar.fourwinds.com (jon@localhost) by darkstar.fourwinds.com (8.15.2/8.15.2/Submit) with ESMTP id 04GNxalN3783011 for ; Sat, 16 May 2020 16:59:36 -0700 Message-Id: <202005162359.04GNxalN3783011@darkstar.fourwinds.com> From: Jon Steinhart To: The Eunuchs Hysterical Society In-reply-to: <20200516235308.icuQH%steffen@sdaoden.eu> References: <20200511005745.GL17035@mcvoy.com> <357EFE54-BD94-4C10-8C43-C6735BF7D317@via.net> <20200511202555.GU17035@mcvoy.com> <20200514173206.GJ20771@mcvoy.com> <20200516235308.icuQH%steffen@sdaoden.eu> Comments: In-reply-to Steffen Nurpmeso message dated "Sun, 17 May 2020 01:53:08 +0200." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3782971.1589673563.1@darkstar.fourwinds.com> Date: Sat, 16 May 2020 16:59:36 -0700 X-JON-SPAM: local delivery Subject: Re: [TUHS] v7 K&R C [really lexers] X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Steffen Nurpmeso writes: > Tony Finch wrote in > : > |Larry McVoy wrote: > |> > |> It's got some perl goodness, regexps are part of the syntax, .... > | > |I got into Unix after perl and I've used it a lot. Back in the 1990s I saw > |Henry Spencer's joke that perl was the Swiss Army Chainsaw of Unix, as a > |riff on lex being its Swiss Army Knife. I came to appreciate lex > |regrettably late: lex makes it remarkably easy to chew through a huge pile > |of text and feed the pieces to some library code written in C. I've been > |using re2c recently (http://re2c.org/), which is differently weird than > |lex, though it still uses YY in all its variable names. It's remarkable > |how much newer lexer/parser generators can't escape from the user > |interface of lex/yacc. Another YY example: http://www.hwaci.com/sw/lemon/ > > P.S.: i really hate automated lexers. I never ever got used to > use them. For learning i once tried to use flex/bison, but > i failed really hard. I like that blood, sweat and tears thing, > and using a lexer seems so shattered, all the pieces. And i find > them really hard to read. > > If you can deal with them they are surely a relief, especially in > rapidly moving syntax situations. But if i look at settled source > code which uses it, for example usr.sbin/ospfd/parse.y, or > usr.sbin/smtpd/parse.y, both of OpenBSD, then i feel lost and am > happy that i do not need to maintain that code. > > --steffen Wow, I've had the opposite experience. I find lex/yacc/flex/bison really easy to use. The issue, which I believe was covered in the early docs, is that some languages are not designed with regularity in mind which makes for ugly code. But to be fair, that code is at least as ugly with hand-crafted code. I believe that the original wisecrack was directed towards FORTRAN. My ancient experience was that it was using lex/yacc for HSPICE was not going to work so I had to hand-craft code for that. Jon