Csup cvsmode build discussion

Ulf Lilleengen lulf at stud.ntnu.no
Wed Jan 16 07:07:05 PST 2008


On ons, jan 16, 2008 at 02:39:26pm +0000, Bob Bishop wrote:
> Hi,
> 
> On 16 Jan 2008, at 13:32, Ulf Lilleengen wrote:
> 
>> On Wed, Jan 16, 2008 at 11:08:20AM +0000, Bob Bishop wrote:
>>> [...]
>>> Why do you want prefixing? And precisely what do you want to do with
>>> parameters?
>>> 
>> Prefixing is needed since csup already have a configuration parser written 
>> in
>> lex/yacc and therefore needed to avoid conflicts.
> 
> You can alternatively avoid conflicts by putting both grammars in the same 
> file, with an entry rule which refers to one or other of the two grammars' 
> real entries based on a defined token. You then arrange for the lexer to 
> supply the appropriate value of the switch token each time the parser is 
> started up.
> 
As noted by others in this thread, the lex and yacc versions in base does in
fact support prefixing. Thus, the only problem is reentrancy, which I've
commented on below.
>> Parameters is nice if one
>> were to modify the parser to take extra arguments, I don't have a concrete
>> example for it yet, but it's nonetheless a requirement for reentrancy. 
>> [etc]
> 
> You may be able to do this using a variation on the above trick.
> 

So for the reentrancy part, what you suggest is that instead of passing the
argument to the reentrant parser, I create the global variables for each
thread using the parser, and then use one or the other global variables
depending on which thread is calling the parser? It's a very interesting
trick, and I think it might work. It's not very "scalable", but it's a good
workaround to be able to use the base system lex and yacc. 

However, this might only fix the issue with yacc if I'm thinking correctly,
because the lexer also needs to be told about this for reentrancy. (But
perhaps a much smaller problem since it's a matter of updating the lex
version in base). 

Anyway, thanks for a useful suggestion. I'll try it out.

-- 
Ulf Lilleengen


More information about the freebsd-hackers mailing list