473,722 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

yacc/bison help

hello I m writing a simple parser using bison. I just used someone's else
c++ grammar, to produce a code beutifier. The thing is , most of the actions
for productions would have form
{$$ = $1 + $2 + $3} and so forth depending on number of terminals in
production. Is it possible to set default action for all the productions
like the one above ? It is something strange to type this formula for over
200 productions.
Feb 19 '08 #1
5 2177
In article <fp**********@i news.gazeta.pl> , thomas <ar*****@o2.plw rote:
>hello I m writing a simple parser using bison. I just used someone's else
c++ grammar, to produce a code beutifier. The thing is , most of the actions
for productions would have form
{$$ = $1 + $2 + $3} and so forth depending on number of terminals in
production. Is it possible to set default action for all the productions
like the one above ? It is something strange to type this formula for over
200 productions.
In a spot-welding newsgroup, would you expect to be able to get
answers about how to drive your lawn-mower, just because the
lawn-mower happened to have some spot-welds?

There is a google group devoted to Lex and Yacc,
http://groups.google.ca/group/compcompilerslex-and-yacc
or you could try comp.compilers or comp.unix.progr ammer

--
"There is nothing so bad but it can masquerade as moral."
-- Walter Lippmann
Feb 19 '08 #2

Użytkownik "Walter Roberson" <ro******@ibd.n rc-cnrc.gc.canapis ał w
wiadomo¶ci news:fp******** **@canopus.cc.u manitoba.ca...
In article <fp**********@i news.gazeta.pl> , thomas <ar*****@o2.plw rote:
>>hello I m writing a simple parser using bison. I just used someone's else
c++ grammar, to produce a code beutifier. The thing is , most of the
actions
for productions would have form
{$$ = $1 + $2 + $3} and so forth depending on number of terminals in
production. Is it possible to set default action for all the productions
like the one above ? It is something strange to type this formula for
over
200 productions.

In a spot-welding newsgroup, would you expect to be able to get
answers about how to drive your lawn-mower, just because the
lawn-mower happened to have some spot-welds?
Yeah you got right, but the group for lawn-mower is moderated, so the answer
about driving would be hard to get, but seriously lex/yacc are realy basis
of computer programing, so I think I will get an answer here.
There is a google group devoted to Lex and Yacc,
http://groups.google.ca/group/compcompilerslex-and-yacc
or you could try comp.compilers or comp.unix.progr ammer

--
"There is nothing so bad but it can masquerade as moral."
-- Walter Lippmann

Feb 19 '08 #3
thomas wrote, On 19/02/08 19:55:
hello I m writing a simple parser using bison. I just used someone's else
<snip>

Neither yacc nor bison are C, you might find comp.compilers a better
place to ask for help, but check their FAQ and a weeks worth of posting
first.
--
Flash Gordon
Feb 19 '08 #4
[comp.lang.c] thomas <ar*****@o2.plw rote:
Yeah you got right, but the group for lawn-mower is moderated, so the answer
about driving would be hard to get, but seriously lex/yacc are realy basis
of computer programing, so I think I will get an answer here.
One could argue that keyboards, monitors, and hard drives are also
basic to computer programming, but no one asks about THEM here and
gets an answer. How about electrons? Pretty tough to program without
those, indeed, but yet again, they aren't discussed here.

Really, just head to the resources you were directed to.

--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gma il.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.or g | Google groups, due to rampant unchecked spam.
Feb 19 '08 #5
thomas wrote:
"Walter Roberson" <ro******@ibd.n rc-cnrc.gc.cawrote :
.... snip ...
>
>In a spot-welding newsgroup, would you expect to be able to get
answers about how to drive your lawn-mower, just because the
lawn-mower happened to have some spot-welds?

Yeah you got right, but the group for lawn-mower is moderated,
so the answer about driving would be hard to get, but seriously
lex/yacc are realy basis of computer programing, so I think I
will get an answer here.
No you won't. lexx and yacc are not mentioned in any of the ISO
standards for C, and this newsgroup deals with the standard C
language, as defined in those standards. Thus you question is
off-topic. Now look at the groups previously recommended, repeated
below.
>
>There is a google group devoted to Lex and Yacc,
http://groups.google.ca/group/compcompilerslex-and-yacc
or you could try comp.compilers or comp.unix.progr ammer
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com

Feb 20 '08 #6

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

Similar topics

18
10752
by: Moonlit | last post by:
Hi, I am searching for the best lex and yacc combination (or something similar) that can be used in combination with C++ and that can contain C++ code. I have the regular flex/bison port working but then I, of course, can't use C++ constructs in the actions. I have tried spirit although I could make a simple command line parser (after too many hours), creating a parser tree with it was not possible in an easy way (the compiler choked...
18
1504
by: Profetas | last post by:
Hi I have been trying to add a mid-rule to my yacc grammar but I always get shift and reduce conflicts pel-0.0.3.y contains 12 shift/reduce conflicts and 12 reduce/reduce conflicts. does anobody know other way? I was using yacc and then I tried bison but they are the same, I have done what is in the manual but there they have a very limited mid-rule topic
3
2048
by: Gvs | last post by:
Hi, i'm trying to implement a few things in lex and yacc though i'm having trouble. What i want to do is be able to parse a term and an expression. in EBNF my term is defined as: term ::= factor { '*' | '\' } . factor is defined as: factor ::= ident | '(' expression ')' | number . expression is defined as: expression ::= '+' | '-' term { '+' '-' term } .
4
4901
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 ? Thanks. -- Rodrick R. Brown
2
2040
by: SSG | last post by:
Hai All! I am new to lex and yacc.. I compile one yacc program , but it tells errors... 10 Rules never reduced.. how to debug the code.. just i am giving my yacc sample code...
3
11822
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:
6
15481
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 these files. Is there any equivalent in the visual studio world? Lots of Greetings! Volker --
2
4493
by: deltaa5 | last post by:
Hi. i need a source code compute logical expressions in lex/yacc. for Example: (20>5) or (6<=6)--->true (1<=2) and (3==1) --->false.
1
2029
by: Robert | last post by:
If the goal is to take a 1-dimensional package of text and produce a tree data structure that is easy to understand and manipulate, and then write C/C++ code that works with that tree - does lex/yacc suit that purpose - i.e. kind of like a tree-manufacturing C library? Or is it for producing a compiler/interpreter the internals of which a new C/ C++ program cannot so easily work with?
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
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
9238
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8052
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
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
5995
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
4502
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
3207
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
3
2147
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.