Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-20-2004, 04:44 PM
|
#1
|
Member
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144
Rep:
|
LEX and YACC with C
Can I use LEX and YACC with a C compiler (GCC), or only C++ compilers (G++ and GCC -X C++) ??
|
|
|
02-22-2004, 01:19 AM
|
#2
|
Member
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 72
Rep:
|
I've only compiled Lex and Yacc files only with C.
The Lex commands should be:
lex LexParse.l <-- makes lex.yy.c file
gcc lex.yy.c -ll <-- to compile the lex file made from previous step. -ll is used tell the compiler to use the lex libraries.
This Yacc command using the Lex file should be:
yacc Yacc.y <-- makes y.tab.c file
lex LexParse.l <-- makes lex.yy.c file
gcc lex.yy.c y.tab.c -ly -ll <-- to combine the lex and yacc file together.
|
|
|
02-22-2004, 07:41 AM
|
#3
|
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Rep:
|
Ya, LEX and YACC are definitely C tools. There is support for C++ in flex but it is considered "experimental".
|
|
|
11-18-2007, 01:34 AM
|
#4
|
LQ Newbie
Registered: Aug 2007
Location: Mysore(KAR), INDIA
Distribution: SLACKWARE12
Posts: 25
Rep:
|
Hi..
am using slakcware 12..
when i run "lex pg.l"
it creates lex.yy.c
but then when i run "gcc lex.yy.c -ll"
i get this error....
Quote:
root@anil:~/dwnlds# gcc lex.yy.c -ll
/usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../i486-slackware-linux/bin/ld: cannot find -ll
collect2: ld returned 1 exit status
|
plz help me....
|
|
|
11-18-2007, 05:12 PM
|
#5
|
LQ Newbie
Registered: Oct 2007
Location: Finland
Distribution: Slackware
Posts: 27
Rep:
|
Slackware 12.0 contains flex.
Use -lfl option instead of -ll.
|
|
|
All times are GMT -5. The time now is 09:24 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|