From owner-cvs-src@FreeBSD.ORG Sun Sep 7 07:40:25 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0043D16A4BF; Sun, 7 Sep 2003 07:40:25 -0700 (PDT) Received: from hermes.aueb.gr (hermes.aueb.gr [195.251.255.142]) by mx1.FreeBSD.org (Postfix) with ESMTP id A891143FD7; Sun, 7 Sep 2003 07:40:23 -0700 (PDT) (envelope-from dds@aueb.gr) Received: from aueb.gr (faculty07.right.dialup.aueb.gr [195.251.255.251]) by hermes.aueb.gr (8.12.9/8.12.9) with ESMTP id h87EeI6T010821; Sun, 7 Sep 2003 17:40:20 +0300 Message-ID: <3F5B42F4.D854AA26@aueb.gr> Date: Sun, 07 Sep 2003 17:38:44 +0300 From: Diomidis Spinellis Organization: Athens University of Ecomomics and Business X-Mailer: Mozilla 4.78 [en] (Windows NT 5.0; U) X-Accept-Language: en,el,de MIME-Version: 1.0 To: Bruce Evans References: <200309041828.h84ISga9035283@repoman.freebsd.org> <20030907191013.U3442@gamplex.bde.org> Content-Type: text/plain; charset=iso-8859-7 Content-Transfer-Encoding: 7bit cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: Jens Schweikhardt Subject: Re: cvs commit: src/bin/sh arith.h arith.y arith_lex.l shell.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2003 14:40:25 -0000 Bruce Evans wrote: > Thanks. I don't know of any style rules for lex and yacc sources other > than very general ones, but it looks reasonable now. Amazingly, style rules for yacc appear in the original Steve Johnson's paper "Yacc: yet Another Compiler-Compiler", contributed by Brian Kernighan, no less. The paper was part of the 7th edition Unix Programmer's Manual, Volume 2, Supplementary Documents (PSD), which is available in PDF format at . "Input Style It is difficult to provide rules with substantial actions and still have a readable specification file. The following style hints owe much to Brian Kernighan. a. Use all capital letters for token names, all lower case letters for nonterminal names. This rule comes under the heading of ``knowing who to blame when things go wrong.'' b. Put grammar rules and actions on separate lines. This allows either to be changed without an automatic need to change the other. c. Put all rules with the same left hand side together. Put the left hand side in only once, and let all following rules begin with a vertical bar. d. Put a semicolon only after the last rule with a given left hand side, and put the semicolon on a separate line. This allows new rules to be easily added. e. Indent rule bodies by two tab stops, and action bodies by three tab stops. " Diomidis - dds@