views:

107

answers:

1

MKS Yacc supports a notation which their web site calls "selection preference syntax". It isn't illustrated, but it consists of a token in square brackets, optionally with a caret, and it indicates that a particular token is required to follow, or is required not to follow, the rest of the rules:

non_terminal:  TOKEN1 non_terminal2 TOKEN2 [TOKEN3]

non_terminal:  TOKEN1 non_terminal2 TOKEN2 [^TOKEN3]

(I'm not clear whether the bracketed item can be a non-terminal. The code I've seen using the notation always uses a token or a couple of space separated tokens, and never a non-terminal.)

Is anyone aware of an alternative Yacc-compatible system (preferably open source) that provides the same support (notation can differ - functionality can't), running on Unix or Linux machines, preferably available in source format?

(MKS Yacc also provides some flexibility in handling errors and adjusting the error behaviour. One way in which that can be used is to treat keywords as identifiers when they are encountered in a position that makes no sense when they are treated as keywords. I was able to retrofit that into byacc - Berkeley Yacc - but I haven't spent enough time working out how to handle 'selection preferences'.)


See also: Has anyone used the "selection preference" mechanism provided by MKS Yacc?

+1  A: 

Just for completeness, since I linked this in the answer to your other version, there appears to be a product from Thinkage called YAY, which is yacc-like and supports the selector syntax. They're in Kitchner and apparently closely associated with MKS, but from the website they also appear to be responsible for MKS's documentation, so maybe if all else fails you can call them as ask what the hell they meant by these selection preferences. ;-)

Charlie Martin