Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!wam!dkim From: dkim@wam.umd.edu (Daeshik Kim) Newsgroups: comp.lang.c Subject: Re: Correct parsing of ternary operator. Keywords: ternary conditional parsing Message-ID: <1990Jan4.072842.1522@wam.umd.edu> Date: 4 Jan 90 07:28:42 GMT References: <9493@batcomputer.tn.cornell.edu> Sender: usenet@wam.umd.edu (USENET Posting) Reply-To: dkim@cscwam.umd.edu (Daeshik Kim) Distribution: comp Organization: University of Maryland at College Park Lines: 21 In article <9493@batcomputer.tn.cornell.edu> lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) writes: > > c ? c = a : c = b; The only way I can guess is follows: 1. having top-down parsing (LL) predictive grammar def. for fast parsing --> ERROR (c)[expr] (?) (c = a)[expr] (:) (c) ... ^^^ HERE, left-to-right scan may predict the last token 'c' an expression 2. having slow bottom-up (LR) right-most grammar --> off course, accept this -- Daeshik Kim H: (301) 445-0475/2147 O: (703) 689-7308 (M,W,F) SCHOOL: dkim@cscwam.umd.edu (uunet!haven!cscwam.umd.edu!dkim) dskim@eng.umd.edu (uunet!haven!eng.umd.edu!dskim) WORK: dkim@daffy.uu.net (uunet!daffy!dkim)