Xref: utzoo comp.unix.programmer:1735 comp.unix.sysv386:7686 comp.unix.xenix.sco:2418 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!umich!vela!srodawa From: srodawa@vela.acs.oakland.edu (Ron Srodawa) Newsgroups: comp.unix.programmer,comp.unix.sysv386,comp.unix.xenix.sco Subject: Re: Connect Speed Message-ID: <6279@vela.acs.oakland.edu> Date: 3 May 91 05:00:23 GMT References: <418@alchemy.UUCP> <1991Apr29.142635.20942@nstar.rn.com> <1991May2.233629.25541@cse.uta.edu> Organization: Oakland University, Rochester MI. Lines: 25 In article <1991May2.233629.25541@cse.uta.edu> rahim@cse.uta.edu (Khalid Rahim) writes: >YACC code. I want to open up a file and should >be able to read it from YACC code. YACC code normally reads from standard input. It calls a routine named yylex to read each token. If you wrote your own, then the solution would be obvious. I assume you used lex to generate this. List the entries in the library gotten by -ll (the lex library). One of these will obviously be the read routine. Write your own with the same name. Now that can open your file. BTW, the source code for the -ll and -ly routines is quite trivial. Some of it is given in the lex and yacc documentation verbatim. You can also look at the lex documentation for a description of how lex reads characters. As a university, we have a source code license for Unix so we just modify the library code (a copy of it) when we need to do this. You might look to flex and bison for freely available equivalent code. -- | Ronald J. Srodawa | Internet: srodawa@vela.oakland.edu | | School of Engineering and CS | UUCP: srodawa@vela.UUCP | | Oakland University | Voice: (313) 370-2247 | | Rochester, Michigan 48309-4401 | |