Fedora Linux Support Community & Resources Center
  #1  
Old 19th March 2010, 12:30 AM
lexslave Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
windows_vistaie
Exclamation lex & yacc

hi there,

i would like to install lex & yacc into my fedora12 o.s.

¿does anyone know the steps?







cheers
Reply With Quote
  #2  
Old 19th March 2010, 12:41 AM
aleph's Avatar
aleph Offline
Banned (for/from) behaving just like everybody else!
 
Join Date: Jul 2007
Location: Beijing, China
Posts: 1,307
linuxfedorafirefox
Re: lex & yacc

The GNU implementation of lex/yacc is called "flex" and "bison" respectively. Just grab them from the repository and you're done.

yum install flex bison

There's also byacc, the BSD yacc, in the repo.
__________________
I believe in nerditarianism. I read FedoraForum for the Fedora-related posts.
Reply With Quote
  #3  
Old 19th March 2010, 06:21 PM
lexslave Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
windows_vistaie
Re: lex & yacc

Quote:
Originally Posted by aleph View Post
The GNU implementation of lex/yacc is called "flex" and "bison" respectively. Just grab them from the repository and you're done.

yum install flex bison

There's also byacc, the BSD yacc, in the repo.
yum install flex bison has to be typed like this inside the terminal window?

i mean - yum install flex - installs flex only?
Reply With Quote
  #4  
Old 19th March 2010, 08:11 PM
dd_wizard's Avatar
dd_wizard Offline
Registered User
 
Join Date: Sep 2009
Posts: 1,409
linuxfedorafirefox
Re: lex & yacc

Yes, "yum install flex bison" gets both unless one is a dependency.

dd_wizard
Reply With Quote
  #5  
Old 19th March 2010, 10:56 PM
lexslave Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
windows_vistaie
Re: lex & yacc

Quote:
Originally Posted by dd_wizard View Post
Yes, "yum install flex bison" gets both unless one is a dependency.

dd_wizard

and it did once i connected to the internet. thanks.


now there's more:


now i'm trying to create my C file by doing:
-flex example.l-
this step works with no problem. it creates the
file lex.yy.c properly.


but when i do
'gcc lex.yy.c -lfl -o program '

says
- bash: gcc: command not found -








S.O.S
Reply With Quote
  #6  
Old 19th March 2010, 12:44 AM
dd_wizard's Avatar
dd_wizard Offline
Registered User
 
Join Date: Sep 2009
Posts: 1,409
linuxfedorafirefox
Re: lex & yacc

I see flex, byacc, and bison in the repos.

dd_wizard

---------- Post added at 04:44 PM CDT ---------- Previous post was at 04:43 PM CDT ----------

Your way to fast, aleph!
Reply With Quote
  #7  
Old 19th March 2010, 01:09 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,150
linuxfedorafirefox
Re: lex & yacc

Note: there are some differences between the old yacc/bison and lex/flex
utilities. Yacc only allows a single parser, bison allows multiple. These differences
carry on into lex/flex. These changes are present in the input files and are make
bison/flex source incompatible with yacc/lex.
Reply With Quote
  #8  
Old 19th March 2010, 01:43 AM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 4,728
linuxfirefox
Re: lex & yacc

You can use either the -l or -X option to force maximum compatibility with traditional lex or POSIX lex, respectively. There is a similar option (-y) to make bison compatible with yacc.
Reply With Quote
  #9  
Old 19th March 2010, 04:20 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,150
linuxfedorafirefox
Re: lex & yacc

These make it more "upwardly" compatible, but there are a few things that
are still a bit different. Most usage is accepted that way, but a full compiler
specification will likely fail without some tweaking.
Reply With Quote
  #10  
Old 19th March 2010, 11:57 PM
Hlingler's Avatar
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,289
linuxopera
Re: lex & yacc

Have you by any chance installed gcc ? Or any of the compilers or development tools ? Just install the whole pile, and be done with it:
su
yum groupinstall "Development Tools" "Development Libraries"


V
Reply With Quote
  #11  
Old 20th March 2010, 02:16 AM
lexslave Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
windows_vistaie
Re: lex & yacc

ok



i have tried it before doin' the
- yum install flex -

and before doing the
- gcc lex.yy.c -lfl -o program -



and the first one, "groupinstall Development Tools" gives an interminable number of
read/write errors while doing the 'transaction' (final part of install).

same with "Development Libraries" it outputs some kind of error as well.




count that i'm using Fedora booting from a usb external device.


¿any solution?
¿would change anything to boot from hard drive?
Reply With Quote
  #12  
Old 20th March 2010, 02:40 AM
aleph's Avatar
aleph Offline
Banned (for/from) behaving just like everybody else!
 
Join Date: Jul 2007
Location: Beijing, China
Posts: 1,307
linuxfedorafirefox
Re: lex & yacc

the Dev Tools group contains a huge amount of software and *****. Perhaps you had your disk space run out before the install completed.
__________________
I believe in nerditarianism. I read FedoraForum for the Fedora-related posts.
Reply With Quote
  #13  
Old 20th March 2010, 04:10 AM
Hlingler's Avatar
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,289
linuxopera
Re: lex & yacc

Post the full output of the errors so that we don't have to guess what's wrong. Or just install the bare minimum compilers:
su
yum install gcc gcc-c++


But it would be best to find out what went wrong: if, as Aleph guesses, you ran out of disk space, that is a bad thing.

V
Reply With Quote
  #14  
Old 20th March 2010, 10:03 PM
lexslave Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
windows_vistaie
Re: lex & yacc

Quote:
Originally Posted by Hlingler View Post
Post the full output of the errors so that we don't have to guess what's wrong. Or just install the bare minimum compilers:
su
yum install gcc gcc-c++


But it would be best to find out what went wrong: if, as Aleph guesses, you ran out of disk space, that is a bad thing.

V
that worked out!.


now doing my output and last file:

gcc lex.yy.c –lfl –o program


(with -lfl command to link with flex library).




but how can i input a file to the executable 'program'.

Since by typing only the word 'program' all alone it shows up that is not a command.

---------- Post added at 10:03 PM CDT ---------- Previous post was at 06:08 PM CDT ----------

anybody home?
Reply With Quote
  #15  
Old 20th March 2010, 11:28 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,150
linuxfedorafirefox
Re: lex & yacc

If you are attempting to develop a small language, you really need to get
a good bit of background on the interaction between flex, bison, and applications...

Flex is used to generate C code (or C++) for a scanner from a specification file.

Bison is used tp generate C code (or C++) for a parser from a specification file.

As a side effect, the generated C/C++ allows for a parser that may use a scanner
from flex or a hand crafted scanner.

None of this goes on to address the application (whether a data processing
application or a compiler).

After compiling all source files (scanner - which may have multiple files, parser -
which again may/will have multiple files, and application - still more source files)
the final executable is generated with the system linker. This is invoked either
directly, or as part of the C/C++ compiler sequence. This usually involve make,
and a lot of libraries (which is why the program development group install is so
useful).

Some of your questions indicate the lack of a development background - I suggest
the textbook "lex & yacc, Second Edition"

(http://oreilly.com/catalo /9781565920002)

which has a number of examples that will help. Besides, I found that the subject is
sufficiently complex that I refer back to it whenever I start another such project. I
just don't remember all of the nuances to the subject.

One of the reasons I prefer flex/bison over lex/yacc is that I sometimes have
situations where I may be scanning/parsing two different files, or the same file
with sections containing different languages... requiring two or more parsers
and scanners. flex/bison allows for this, lex/yacc does not. Flex/Bison are
also more portable in that flex/bison run on more platforms than does lex/yacc.

Last edited by jpollard; 20th March 2010 at 11:31 PM.
Reply With Quote
Reply

Tags
lex, yacc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use lex and yacc?plz help.. dawg0x0 Using Fedora 7 29th October 2010 04:39 AM
cc flex yacc not working aiswarya Using Fedora 1 13th April 2008 09:29 AM
No yacc/lex for Linux/FC3? TheProgrammer Using Fedora 2 3rd February 2005 12:49 PM


Current GMT-time: 09:22 (Thursday, 20-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat