473,396 Members | 1,846 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,396 software developers and data experts.

yacc, same token

Hi All

Here is my .l file, when the input is '1', the token will match mame,
but sometime i want it matches "values". how to?

chars [A-za-z0-9\_\'\.\"]
int [0-9]+
string \"{chars}+\"
words {chars}+
values {int}|{string}|{bool}
name [a-zA-Z0-9]+

thanks
from Peter (cm****@hotmail.com)

Dec 23 '05 #1
2 1291
cm****@hotmail.com wrote:
Hi All

Here is my .l file, when the input is '1', the token will match mame,
but sometime i want it matches "values". how to?

chars [A-za-z0-9\_\'\.\"]
int [0-9]+
string \"{chars}+\"
words {chars}+
values {int}|{string}|{bool}
name [a-zA-Z0-9]+

thanks
from Peter (cm****@hotmail.com)

Well, how do you distinguish between a name and a value? (Perhaps you
shouldn't allow a number to be a name)

Robert
Dec 23 '05 #2
cm****@hotmail.com wrote:
Hi All

Here is my .l file, when the input is '1', the token will match mame,
but sometime i want it matches "values". how to?


<snip>

Yacc is not C, please ask somewhere yacc is topical, not here.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Dec 23 '05 #3

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

Similar topics

1
by: cylin | last post by:
Dear all, I am a newbie using lex and yacc. I really don't know what's wrong with my code, because the output is not what I want. My yacc rules don't match, and yylex seems just read only one...
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 ? ...
4
by: SSG | last post by:
I tried one lex, yacc program, but it says the error yacc: e - line 349 of "comp_y.y", a token appears on the lhs of a production can anyone tell me about the error.. How to solve it... ...
3
by: John Sasso | last post by:
In my Yacc .y file I defined: %union { int value; struct Symbol Sym; } The Symbol struct I defined in a header file I #included in the Prologue section of the .y file as:
1
by: ajaxjinx | last post by:
%token NUMBER %token LETTER %start cmd %%
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 :
2
by: betterking | last post by:
I want to write a tiny sql parser with lex and yacc. At first I just write sql.l sql.y with simple CREATE TABLE funciton. sql.l %{ #include "y.tab.h" //<> #include <stdlib.h> #include...
3
by: latif87 | last post by:
An example of how the XML file is structured: <xml> <farm name="NAME1"> <size x="INTEGER1" y="INTEGER2" /> <neighbor name="NAME2" /> <crop name="PLANT" area="INTEGER3" /> <crop … /> … </farm>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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
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...
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,...

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.