Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-06-01 11:37:11


On Friday 01 June 2001 12:29 pm, you wrote:
> joel de guzman wrote:
> > From: "Greg Colvin" :
> > > > > And don't forget
> > > > >
> > > > > a*b*c
> > > > >
> > > > > Commutative for numbers, but not matrices, and a common
> > > > > substitute in computer languages for
> > > > >
> > > > > a b c
> > > > >
> > > > > in algebra. Nice high precedence too.
> > > >
> > > > Clashes with the Kleene star.
> > >
> > > What clash? If
> > > A * A
> > > in Spirit means
> > > A A
> > > in EBNF and if
> > > *A
> > > in Spirit means
> > > A*
> > > in EBNF then
> > > *A
> > > in Spirit matches nothing, or
> > > A
> > > or
> > > A * A
> > > or
> > > A * A * A
> > > and so on.
> >
> > Hello Greg,
> >
> > That's the coolest argument I've seen so far!
> > At first I didn't get it but a second look and
> > omi-gosh, he's right!!! You are great, man!
> >
> > a b <in math> ----> a * b <in programming>
> > a b <in BNF> ----> a * b <in Spirit>
> >
> > nice parallels!
> >
> > *a ---> nothing | a | a * a | a * a * a | a * a * a * a....
> >
> > <star> a means repeat the <stars> as many as you want.
> > And as many stars as the heavens!
>
> Yet One more possibility. Postfix -- and ++ to mean BNF postfix * and +.

Those however deviate from the Kleene star closure and positive closure
notation too far to be recognizable. A C++ programmer that's used/seen the
Kleen star will realize that *a is a* because a* isn't possible in C++. With
postfix ++ and --, there's no connection.

> Also, if * means sequence, why not make + mean alternative?

This seems to fit well with regular expressions, but remember that Yacc uses
'|' to separate alternatives. I think it would be wise to follow Yacc's lead
on this, because it has been around for a _lot_ longer.

> I know that's an awful lot of +'s. But then why not & and | to mean BNF
> sequence and alternative. I know you responded before about using & for
> this, but your objection had something to do with convention meaning for
> the operators was violated. But certainly the above use of * does not
> reflect conventional meaning. Or maybe I misunderstood your previous
> objection to using &.

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk