Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!uakari.primate.wisc.edu!sdd.hp.com!news.cs.indiana.edu!ariel.unm.edu!nmsu!opus!eoshaugh From: eoshaugh@nmsu.edu (Erik Oshaughnessy) Newsgroups: comp.unix.programmer Subject: Re: lex, yacc question Message-ID: Date: 13 Jun 91 17:48:46 GMT References: Sender: news@NMSU.Edu Distribution: comp Organization: Campus Crusade for Chthulu Lines: 29 In-reply-to: plona@romulus.rutgers.edu's message of 12 Jun 91 23:22:57 GMT plona@romulus.rutgers.edu (Lawrence Plona) writes: ]From: ricks@nrl.navy.mil (Richard Schumeyer) ]> Is there a way to get lex and yacc to read from somewhere other than ]> stdin? ] ] yacc declares "FILE *yyin". A pre-processor might be set up like: ] ] extern FILE *yyin; ] ] yyin = popen( "/usr/bin/m4 infile", "r" ); ] yyparse(); ] pclose( yyin ); Both yacc and lex use the file pointers yyin and yyout to communicate with the environment. I'm not exactly sure why Mr. Plona used popen(3) to start another process when the same thing can be accomplished by an fopen(3) call, without the extra overhead of the second process. What benifits are gained from this, if at all? Inquiring minds want to know! -- ___________________________________________________________________________ Erik O'Shaughnessy Mac/Unix Support Guy |Phrase of the day: Small Systems | "Poetically Inert" New Mexico State University | eoshaugh@nmsu.edu |"Help! I'm in ed!" - me ----------------------------------------------------------------------------