Date: Wed, 16 Jan 2008 16:06:56 +0100 From: Ulf Lilleengen <lulf@stud.ntnu.no> To: Bob Bishop <rb@gid.co.uk> Cc: freebsd-hackers@freebsd.org Subject: Re: Csup cvsmode build discussion Message-ID: <20080116150655.GA47095@carrot.studby.ntnu.no> In-Reply-To: <D95047BD-C463-45CF-8588-B6E463FE32B7@gid.co.uk> References: <20080116093302.GA13632@carrot.studby.ntnu.no> <0CE4984F-41F7-44EA-9FE7-0E573DB2B338@gid.co.uk> <20080116133214.GA2666@carrot.studby.ntnu.no> <D95047BD-C463-45CF-8588-B6E463FE32B7@gid.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080116150655.GA47095>