473,802 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Building a parser

vpawizard
66 New Member
Hello,
I am developing a small compiler which recognizes expression like 10+20,10-1*30 and so on. I am using Lex for generating Lexer and Yacc for parser. I created a header file defining the integer values for tokens and this header was included in both lexer and parser. Actually, I assigned some wrong values to tokens and parser did not work. Then I corrected the values and parser worked correctly. I want to know if there is any technique by which I can use both lex and yacc to build a compiler and "avoid assigning values" to tokens. i.e. I want some way so that the lexer sends the token back to parser and parser recognizes its correct type.

Thanx in advance.
Nov 13 '06 #1
1 1517
vpawizard
66 New Member
I got the solution after some googling....... .......

bison -d xyz.y creates xyz.tab.h which automatically assigns integer values to kens which can be used by Lexer.
Nov 16 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1471
by: Sridhar R | last post by:
I am looking for a class browser that has these features. 1. Given a symbol (class, method or function) it should giveback the lineno n source code 2. It should be efficient and quick. I looked at the `pyclbr` module, but it's slower. I will be _often_ regenerating the symbols from exactly one python source file. But for an average python script in my machine it takes 2 secs for pyclbr to build the dictionary of symbols.
1
5289
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o Modules/python.c gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o...
6
2455
by: John Kooistra | last post by:
Hi! I'm looking to generate an HTML table via XSL using XML data. Specifically, I want to arrange my data in a table with rows of 6 columns. So, I have this conditional XSL statement setup to open and close <tr>'s when appropriate. Unfortunately, the XSL parser doesn't like the fact that within the <xsl:when> block there is no closing tag for <tr>. (ie. Receive the
16
1832
by: sirsean | last post by:
Hi all. I'm trying to dynamically build menus and objects after my page loads. Data is stored in an XML file and is parsed at runtime into Javascript objects. At the moment, I'm working on creating menu items from these objects. The parsing works fine (using Sarissa), and Firefox builds the menu no problem. IE, however, does not. The functionality of the menu will be a single onclick event. It seems that Firefox allows me to set the...
17
2544
by: Student | last post by:
Hi All, I have an assignment for my Programming language project to create a compiler that takes a C++ file as input and translate it into the C file. Here I have to take care of inheritance and operator overloading and virtual functions. I mean it should not hamper the C++ meaning. In frank and simple terms i need to implement a small C++ compiler in C++, and i want the intermediate representation to be C. Please help me in this....
1
4916
by: Justin Johnson | last post by:
Hello, I'm trying to build Python 2.5.0 on AIX 5.3 using IBM's compiler (VisualAge C++ Professional / C for AIX Compiler, Version 6). I run configure and make, but makes fails with undefined symbols. See the output from configure and make below. svnadm /svn/build/python-2.5.0>env CC=cc CXX=xlC ./configure --prefix=$base_dir \ checking MACHDEP... aix5
1
1261
by: AMDRIT | last post by:
Occasionally I try my hand at a simple data storage engine. Today I ran across an article on the web http://msdn2.microsoft.com/en-us/library/aa289151(vs.71).aspx, and it got me thinking again. There doesn't seem to be a definative source, at least on in layman terms, on this subject. Here is what I believe to know so far. (As if I was to model after SQL Server).
0
2244
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): PERL5LIB=/Users/Ric/Library/Perl/ ls XML-Parser-2.34/ XML-Parser-2.34.tar
2
1647
by: The Pythonista | last post by:
First of all, I apologize if this would be more appropriate for python- dev, but I don't normally subscribe to that list, and felt it would also be of general use, so.... I'm having problems building the latest Python 2.6 and 3.0 from subversion, and I'm not sure how to resolve the problem. In each case, configure executes without problem, but, when I execute 'make', I get this error (the same one for both 2.6 and 3.0): ...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7598
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.