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=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8677 invoked from network); 17 May 2020 01:23:52 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 17 May 2020 01:23:52 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 6244E9C62E; Sun, 17 May 2020 11:23:48 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id A01A69C5E4; Sun, 17 May 2020 11:23:20 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.b="uXh5zOA1"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 72DFE9C5E4; Sun, 17 May 2020 11:23:18 +1000 (AEST) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by minnie.tuhs.org (Postfix) with ESMTPS id 479619C5E1 for ; Sun, 17 May 2020 11:23:17 +1000 (AEST) Received: by mail-qk1-f182.google.com with SMTP id y22so6741628qki.3 for ; Sat, 16 May 2020 18:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XymMFnk8D3twAOK2sqQlZQBeGUh4UslykrVhPb9H+Ak=; b=uXh5zOA1nTBQzKbG6nDZzmLjuxLM3DhWzQVNuu7/or5cMYfM2r9cqrE5t0t+HOvMGL jv/OAky4rNd3mZ7oj47bGReIHzTZwBO1L09n/K5lwetCRIyCNfk0mud8gTassw04qELL 2YaRQROCfPbkNwJR5bTzMzoToNaHh7TXkXmIi9o6oiCJi1ex5Jxr1ms60JvpUE1cpyp7 aeofFYWq7lEecbkuydlZ5/PmJA7B3mFepkjv2MbnS0TrNsZyaXDJKFP1v+68dk1rq7wS +Xh+QR+Z6xzGTzHjfrt878Na+rk+6phBkz8PtDeJvTjMikcUGXoK7Ac3aGB3T4vdrrHl S6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XymMFnk8D3twAOK2sqQlZQBeGUh4UslykrVhPb9H+Ak=; b=knFGC1z3Nk9DsK0AEYsd1QSxdC+HsCrPjaPxd/S+JjT9dFWffkXoaNC+/5DpMUIzdZ qV+mnWGgvvhMv+JMoU4TAAXmeMbKA+uBQLL1aytZI8/MIk9n0K3r0uRrVxA2Ks5gpUZ5 0A3q+fW7V/+pZyFSXmQisQs70o1jbuI9I+KtFCjXsHSlCD64jZIpK/U7/IQssz6oFrZJ v3EqsWyVwHnUlgd5ELTuDNa1VoHe8mVuiDaYRpu1JHkjBq3S3C9vsFaMr9cnaJWDH32B Dmw5xnOCl3cCT+NUB9KsVXPFb/kV04CGsnWZNtOTycx7eNzR7xsj7GIHR2PVPnBo0P2x ABFw== X-Gm-Message-State: AOAM530rNwTXUZlkaKYNQnP91bRDLHZa4LxBGz7NBj3KQycs45VRtFhK RuWhzbYFxwSTanvXGubhqgYaGEi7/XvQs2rDsssS08Ya X-Google-Smtp-Source: ABdhPJxc4qKsHcFIsd4csDYbf4DrushpWL1wJXrV6LiEvaXQaApuGMzB88qNhrfHo47YfmNFCBgslI+VVw4aQCIsrfk= X-Received: by 2002:a37:a9d6:: with SMTP id s205mr9810391qke.380.1589678596174; Sat, 16 May 2020 18:23:16 -0700 (PDT) MIME-Version: 1.0 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> <202005162359.04GNxalN3783011@darkstar.fourwinds.com> In-Reply-To: From: Warner Losh Date: Sat, 16 May 2020 19:23:04 -0600 Message-ID: To: Brantley Coile Content-Type: multipart/alternative; boundary="0000000000000849f905a5cde410" 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: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --0000000000000849f905a5cde410 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, May 16, 2020, 6:05 PM Brantley Coile wrote: > =E2=80=9CThe asteroid to kill this dinosaur is still in orbit.=E2=80=9C > > =E2=80=94- Plan 9 lex man page > > > I always hand craft my lexers and use yacc to parse. Most code on plan 9 > does that as well. > Wow! That is the most awesome thing I've seen in a while.... Warner Brantley > > > On May 16, 2020, at 8:00 PM, Jon Steinhart wrote: > > =EF=BB=BFSteffen 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 s= aw > > |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 pi= le > > |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 mak= es > 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 wor= k > so I > had to hand-craft code for that. > > Jon > > --0000000000000849f905a5cde410 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sat, May 16, 2020, 6:05 PM Brantley Coile <brantley@coraid.com> wrote:
=E2=80=9C=
The asteroid to kill this dinosaur is still in orbit.=E2=80=9C
    =E2=
=80=94- Plan 9 lex man page

I always hand craft my lexers and use yacc to parse. Most =C2=A0code on pla= n 9 does that as well.=C2=A0

Wow! That is the most awesome thing I= 've seen in a while....

Warner


=C2=A0 Brantley


On May 16, 2020, at 8:00 PM, Jon Steinhart <jon= @fourwinds.com> wrote:

=EF=BB=BFSteffen Nurpmeso writes:
Tony Finch wrote in
<alpi= ne.DEB.2.20.2005142316170.3374@grey.csi.cam.ac.uk>:
|Larry McVoy <lm@mcvoy.com> wrote:
|>
|> It's got some perl goodness, rege= xps are part of the syntax, ....
|
|I got into Unix after perl and I've us= ed 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 librar= y code written in C. I've been
|using re2c recently (http://re2c.org/), which i= s differently weird than
|lex, though it still uses YY in all its va= riable 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.=C2=A0= I never ever got used to
use them.=C2=A0 For learning i once tried t= o use flex/bison, but
i failed really hard.=C2=A0 I like that blo= od, sweat and tears thing,
and using a lexer seems so shattered, all t= he pieces.=C2=A0 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.=C2=A0 But= if i look at settled source
code which uses it, for example usr.sbin/os= pfd/parse.y, or
usr.sbin/smtpd/parse.y, both of OpenBSD, th= en i feel lost and am
happy that i do not need to maintain that c= ode.

--steffen

Wow, I've had the opposite experience.=C2=A0 I find lex/yacc/flex= /bison really
easy to use.=C2=A0 The issue, which I believe was covered in the earl= y docs,
is that some languages are not designed with regularity in mind which= makes
for ugly code.=C2=A0 But to be fair, that code is at least as ugly wi= th hand-crafted
code.

I believe that the original wisecrack was directed towards FORTRAN.= =C2=A0 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
--0000000000000849f905a5cde410--