rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Emin Gun Sirer <egsirer@phoenix.Princeton.EDU>
To: dmason@plg.uwaterloo.ca, rc@hawkwind.utcs.toronto.edu
Subject: Re: more wishes for chrismas
Date: Sat, 5 Dec 1992 15:52:02 -0500	[thread overview]
Message-ID: <9212052052.AA08118@tan.Princeton.EDU> (raw)

>From: Dave Mason <dmason@plg.uwaterloo.ca>
>Date: 	Sat, 5 Dec 1992 11:21:13 -0500
>
>> Date: Fri, 4 Dec 1992 09:02:51 -0500
>> From: Alan Watson <alan@oldp.astro.wisc.edu>
>> 
>> There are a few characters which only make sense at certain places --
>> like "=" which has to be quoted in dd commands -- but at least the
>> current rules have a simplicity about them.
>
>This is the only spot where I get bitten occasionally and wouldn't
>mind a change.  If local assignments were only allowed at the
>beginning of lines, then:
>	dd count=1 bs=512
>wouldn't cause a problem.  In fact, looking at the grammar in the rc
>manual, assignments *are* only allowed at the beginning of lines, and
>I don't see the rule that causes the problem.

Yes, promotion is inconsistent. For example:
;~ a sdfdsfg
[status 1]
;ls file1 ~ file3
;ls file1 = file3
[syntax error]

;in arg1
syntax error
;cmnd in asfd
;(elem1 in elem3)

So the rule in the latter part is that the keyword gets promoted to a string
unless it is the first word on a line. But the same thing is not true of "=",
which does not get promoted anywhere. However, "~" gets promoted around
*in the lexer*, which is not a good thing.

The solutions I see, in order of desirability as far as I'm concerned:

	1. Fix dd and awk (I was at Bell Labs when someone changed the plan9
dd to take "-infile fname" and "-outfile" as opposed to "infile=fname". People
were furious that a lot of their scripts had to be fixed. But it only
happens once and saves a lot of headache later on).

	1. Promote '=' as if it was a keyword. Put '~' promotion in the
grammer along with '='.

	1. Promote all syntax error causing keyword constructs to strings 
(this'll require following multiple paths through the parser but is doable)
and retry.

	Duff's rc paper praises sh for using recursive descent, but criticizes
it because a lot of the routines change their behaviour according to some
flags. The counterpart to this in a yacc-based program is the special
treatment of certain tokens in the lexer. Yes, it's nice that rc has a
yacc grammer that anyone can understand, but does everyone know when a given
character represents token TWIDDLE or CHAR and is this treatment uniform
for all characters that are more or less the same ??

	Gun.


             reply	other threads:[~1992-12-05 20:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-12-05 20:52 Emin Gun Sirer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-12-06  8:21 Byron Rakitzis
1992-12-04 22:05 Chris Siebenmann
1992-12-04 16:53 Tom Culliton x2278
1992-12-04 14:58 peter
1992-12-04 14:02 Alan Watson
1992-12-04 14:48 ` Steve Rezsutek
1992-12-05 16:21 ` Dave Mason
1992-12-04 12:53 malte
1992-12-04 14:03 ` Gerry.Tomlinson
1992-12-08 15:21 ` Mark-Jason Dominus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9212052052.AA08118@tan.Princeton.EDU \
    --to=egsirer@phoenix.princeton.edu \
    --cc=dmason@plg.uwaterloo.ca \
    --cc=rc@hawkwind.utcs.toronto.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).