Lex/Yacc and multiple input files
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Lex/Yacc and multiple input files




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Lex/Yacc and multiple input files  
max.giacometti@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-21-07 12:22 PM

Hi everybody!

I am using lex and yacc to write a vhdl to systemc converter.

Lex simply reads the input file and yacc implements grammar and
translation.

I'd like to be able to make yacc able to command lex to stop reading
the current file and starting reading another file, when the inclusion
syntax is reached.

How can I do that?

Thanks,

Max






[ Post a follow-up to this message ]



    Re: Lex/Yacc and multiple input files  
B. Augestad


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-21-07 06:19 PM

max.giacometti@gmail.com wrote:
> Hi everybody!
>
> I am using lex and yacc to write a vhdl to systemc converter.
>
> Lex simply reads the input file and yacc implements grammar and
> translation.
>
> I'd like to be able to make yacc able to command lex to stop reading
> the current file and starting reading another file, when the inclusion
> syntax is reached.
>
> How can I do that?
>

I guess that the easiest and most maintainable way is to use a
preprocessor step, just like the C compiler does. That way lex&yacc can
parse everything as one file.

If you stick with the C syntax for preprocessing directives, you can
even use the C preprocessor itself.

Just my 0.02$
Boa


--
Looking for an embeddable web server?
http://www.metasystems.no/products/...nder/index.html





[ Post a follow-up to this message ]



    Re: Lex/Yacc and multiple input files  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-22-07 12:18 PM

max.giacometti@gmail.com wrote:

> I'd like to be able to make yacc able to command lex to stop reading
> the current file and starting reading another file, when the inclusion
> syntax is reached.

By having a rule in either the lex or yacc that recognizes the inclusion
syntax.  I've found lex to be more malleable than yacc.

For an example, cproto does this -

http://invisible-island.net/cproto/

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:29 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register