[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grammar question


Well, you could set up all the permutations. But what I do
is keep track of the frequencies, and enforce the count (of 1) with hand

The hand coding is going to be less work than building all the
permutations! AND, heaven help you if you have to add a 6th, 7th, etc


On Tue, 2001-10-30 at 14:45, Todd Ogrin wrote:
> I'm hoping two things right now: 1) that this is the
> right place to send this question, and 2) that it
> isn't in some obvious FAQ somewhere.  In any case...
> I'm trying to develop a SableCC grammar that includes
> a production of numerous "at-most-one" items whose
> order is irrelevant.  
> For example, using the tokens A, B, and C, all the
> following would be acceptable: ABC, CAB, C, A, BAC,
> AB, etc.  Unacceptable examples include: CC, ABB,
> ACAB.  Basically any string with duplicates is out,
> and I don't care about the ordering of the items that
> ARE there.
> Any hints?  I'm afraid that I'm going to have to
> enumerate all the permutations.  This wouldn't be bad
> with 3 elements, but in my actual application I have
> 5, which makes for 120 things OR'ed together.  Ick.
> Thanks for reading.  Any suggestions would be
> appreciated!
> --
> R. Todd Ogrin
> toddogrin@yahoo.com
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com
murf:   Steve Murphy, 	       CTO & VP Technology
        57 Lane 17        Electronic Tools Company
        Cody, Wyoming          work: (307)754-8154
        82414-9688             home: (307)754-5675
        email:                    murf@e-tools.com

PGP signature