Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!OgcVax!Tombl@Berkeley From: Tombl@Berkeley@OgcVax.UUCP Newsgroups: net.lang.prolog Subject: CProlog Bug Message-ID: <3285@sri-arpa.UUCP> Date: Sun, 10-Jul-83 23:54:08 EDT Article-I.D.: sri-arpa.3285 Posted: Sun Jul 10 23:54:08 1983 Date-Received: Fri, 22-Jul-83 12:46:28 EDT Lines: 38 There is a bug in the CProlog grammar rules. Translation of expressions of the following form may be affected: (expr1 ; expr2) The current rules produce code which may incorrectly bind the return que for some instances of user code. For example, the expression ( funct(arg1,...,argn) ; {expr1} ) is translated to produce funct(arg1,...,argn,Input,Output) for the left member, which is correct. Translation of the right member returns expr1, also correct, but has the side effect of binding its input que to its output que. These happen also to be the input and output ques for the expression as a whole, so the left member translation effectively becomes funct(arg1,...,argn,Input,Input) which is incorrect. The bug fix is straightforward, and should be applied to prolog/pl/grammar: 30,32c30,32 < $t_rp((T;R),S,SR,(Tt;Rt)) :- !, /* distributed code */ < $t_rp(T,S,SR,Tt), < $t_rp(R,S,SR,Rt). --- > $t_rp((T;R),S,SR,(Tt,SR=SR1;Rt,SR=SR2)) :- !, /* modified code */ > $t_rp(T,S,SR1,Tt), > $t_rp(R,S,SR2,Rt). I'd be interested in seeing a better solution, if someone should come up with one. -- Tom Blenko decvax!tektronix!ogcvax!metheus!tombl ucbvax!tektronix!ogcvax!metheus!tombl