473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Lex/Yacc and multiple input files

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

May 18 '07 #1
2 7467
ma************@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?
Thanks,

Max
This is off topic in comp.lang.c, a better place to ask is in
comp.compilers and/or comp.unix.programmer.

<ot>
If you use flex, you can read the man page for flex and search for the
section named MULTIPLE INPUT BUFFERS.
</ot>

Bjørn

--
Looking for an embeddable web server?
http://www.metasystems.no/products/h...der/index.html
May 18 '07 #2
ma************@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.

Use three stages: character input --lex --yacc. The character input
is responsible for input files, character set translations, include
file stacking, etc, to present lex with a continuous stream of characters
from various sources. Depending on how vhdl does inclusion, either lex
or yacc might recognise it and send back to the character input commands
on including files. The tricky part is that you may have characters
buffered in lex and tokens buffered in yacc so that if you don't arrange
it carefully, you can read past where included text is inserted.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I ASSURE YOU WE'RE OPEN!
May 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: x. zhang | last post by:
Hi Guys, We know that we can use <input type=file ...> to upload one file per time to the server. My question is if there are some way to upload multiple files per time to the server. (Of...
4
by: Rodrick Brown | last post by:
This might be off topic but can someone give me a quick run down on why tools like lexx/yacc/bison are usefull ? I know what there used for but not sure when they should be used and where ? ...
6
by: Volker Hetzer | last post by:
Hi! We are finding ourselves in a situation where we have to parse several more or less free format text files. In the past, on linux, we had flex and bison for generating very fast parsers for...
2
by: Baron Samedi | last post by:
I have been looking around for an editor which edit serialised files (as created with the PHP function serialize()), but can't find one, so I have decided to code my own. I can either hand code...
13
by: Berk Birand | last post by:
Hi, I am working on a school project where we use lex/yacc to write a compiler for a fictional (Java-like) language. I have handled all the details about the yacc and lex files, but I still have...
2
by: Mohitz | last post by:
Hi Guys, I am facing a peculiar problem with my yacc script. Following is the snippet of the yacc script that i am using. I am using lex as the lexical analyzer. Sample Input :
0
by: Laszlo Nagy | last post by:
This is a fragment from my yacc file: import ply.yacc as yacc from lex import tokens from ast import * def p_msd(p): r"""msd : SCHEMA WORD LBRACE defs RBRACE """ p = MSDSchema(p)
43
by: bonneylake | last post by:
Hey Everyone, Well this is my first time asking a question on here so please forgive me if i post my question in the wrong section. What i am trying to do is upload multiple files like gmail...
4
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.