lex, yacc question

Erik Oshaughnessy eoshaugh at nmsu.edu
Fri Jun 14 03:48:46 AEST 1991


plona at romulus.rutgers.edu (Lawrence Plona) writes:
]From: ricks at 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 at nmsu.edu			|"Help! I'm in ed!" - me
----------------------------------------------------------------------------



More information about the Comp.unix.programmer mailing list