lex, yacc question

lex, yacc question

Post by Timothy Jon » Sat, 15 Jun 1991 04:41:59



Or, you could do a reopen() on the input file and stdin.
--
                                        - Tim Jones

 
 
 

lex, yacc question

Post by Erik Oshaughnes » Sat, 15 Jun 1991 02:48:46



]> 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             |

----------------------------------------------------------------------------

 
 
 

lex, yacc question

Post by Richard Schumey » Fri, 14 Jun 1991 04:52:24


Is there a way to get lex and yacc to read from somewhere other than
stdin?  
--
------------------------------------------------------------

Naval Research Lab       (202)404-7966
Space Science Division
------------------------------------------------------------
 
 
 

lex, yacc question

Post by Richard Schumey » Sat, 15 Jun 1991 07:33:46


I appreciate everyone's response to my lex, yacc question.  I now have
another one:  I want to be able to call yyparse() more than once to
parse different files.  For testing, I have it set up to parse the
same file twice.  The first time, everything works fine.  The
second time the parser returns an error.  Do I need to reinitialize
yyparse somehow before using it again?  How?

--
------------------------------------------------------------

Naval Research Lab       (202)404-7966
Space Science Division
------------------------------------------------------------

 
 
 

lex, yacc question

Post by Lawrence Plo » Fri, 14 Jun 1991 08:22:57



Quote:> 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 );
--

Sit denique inscriptum in fronte unius  "Let it finally be written on
cuiusque quid de rebus publicis sentiat  the forehead of each man what he
- Cicero                                 thinks of open systems"

 
 
 

1. lex/yacc question

Gentlefolks:

I need to specify an ascii character in a regular expression by its byte
value, specically an EXCAPE character.

How do I do specify the byte value? by using \0x010 or ???

Thanks

Alan Walkington
Member of the Technical Staff
United Defense L.P., San Jose

2. what's two_to_onep? (SunOS 4.1.1 and gcc)

3. more scsi board install questions

4. LEX/YACC Question

5. apache and cgi

6. lex/yacc question

7. Apache: Parse all .xhtml by own script

8. Simple lex v. yacc question

9. Lex (Flex) and Yacc (or Bison) questions.

10. LEX / YACC yywrap() question

11. Followup YACC & LEX Question

12. YACC and LEX question