Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!unmvax!bbx!bbxsda!scott From: scott@bbxsda.UUCP (Scott Amspoker) Newsgroups: comp.lang.c Subject: Re: lex & yacc - cupla questions Keywords: lex yacc Message-ID: <935@bbxsda.UUCP> Date: 6 Aug 90 18:17:51 GMT References: <1990Jul26.175545.959@uicbert.eecs.uic.edu> <1990Jul27.185058.6257@aucs.uucp> <1990Jul30.202119.2768@xenitec.on.ca> Reply-To: scott@bbxsda.UUCP (Scott Amspoker) Distribution: comp Organization: Basis International, Albuquerque, NM Lines: 23 In article <1990Jul30.202119.2768@xenitec.on.ca> timk@xenitec.UUCP (Tim Kuehn) writes: >(Dave Astels) writes: >>woodward@uicbert.eecs.uic.edu writes: >>>3.) if i have a yacc construct such as: >>> >>>line3 : A B C >>> { yacc action sequence } >>> >>>how can i now assign the values of A, B, and C into local vars of my >>>choice? the problem lies in the fact that each of A B and C represent >>>three calls to lex, and if i pass back a pointer to yytext[] from lex, >>>i only retain the value of the last token in the sequence, in this case C, >>>when i get to the action sequence in my yacc code. Sometimes you got to get your fingernails a little dirty. If you wish to return tokens from lex that have arbitrarily long lexemes (such as string litererals or symbol names) you will have to setup your own dynamic buffering mechanism to retain such values. -- Scott Amspoker Basis International, Albuquerque, NM (505) 345-5232 unmvax.cs.unm.edu!bbx!bbxsda!scott