Subject: ash & POSIX 1003.2 q's
To: VaX#n8 <>
From: Garrett Wollman <>
List: tech-userlevel
Date: 01/27/1997 11:58:38
<<On Mon, 27 Jan 1997 01:23:46 -0600, VaX#n8 <> said:

> I'm a little disappointed that pdksh doesn't use something
> like yacc, but perhaps there is a good reason (the tables get too big?
> suboptimal generated parsers?)

Tom Duff once noted that the grammar given in the AT&T sh(1) man page
did not allow even such simple commands as `who | wc'.  He then went
on to say, ``[There is] an even darker secret: nobody really knows
what the Bourne shell's grammar is.''  (Sorry, I can't find the
reference for this right now.)  The original Bourne shell was
implemented with a recursive-descent parser, but with so many flags
and special options to each function that it was next-to-impossible
for someone to determine by inspection precisely what language it
would accept.  Add to that the fact that it was written in BOURNEGOL,
and it's no wonder people had difficulty writing programs which
attempted to interpret the same language.

Of course, the POSIX folk have actually come up with a grammar for
their version of the Bourne shell, but I would be surprised if anybody
knew whether it actually described the input language of the
original.  (Actually, I am quite certain that it doesn't, since the
original Bourne shell didn't have shell functions.  But the point
still stands even stipulating this.)


Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, ANA, or NSA|                     - Susan Aglukark and Chad Irschick