LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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



Reply
 
Search this Thread
Old 02-20-2004, 05:44 PM   #1
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Rep: Reputation: 15
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++) ??
 
Old 02-22-2004, 02:19 AM   #2
excel28
Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 72

Rep: Reputation: 15
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.
 
Old 02-22-2004, 08:41 AM   #3
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
Ya, LEX and YACC are definitely C tools. There is support for C++ in flex but it is considered "experimental".
 
Old 11-18-2007, 02:34 AM   #4
a1ora0
LQ Newbie
 
Registered: Aug 2007
Location: Mysore(KAR), INDIA
Distribution: SLACKWARE12
Posts: 25

Rep: Reputation: 15
Unhappy

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....
 
Old 11-18-2007, 06:12 PM   #5
Fidori
LQ Newbie
 
Registered: Oct 2007
Location: Finland
Distribution: Slackware
Posts: 24

Rep: Reputation: 8
Slackware 12.0 contains flex.

Use -lfl option instead of -ll.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
does ubuntu have lex and yacc,how to use them?? akshay_jp Linux - Software 4 05-26-2010 07:36 PM
Lex and Yacc on Federo 2.0 vivekian Fedora 6 05-20-2006 10:09 AM
Error in Makefile for Lex and Yacc oulevon Programming 2 10-24-2005 01:52 AM
Lex and Yacc on Mandrake 9.2.2 Anuradha Linux - Software 0 07-02-2005 04:32 AM
Lex & YACC coolfrog Programming 3 09-25-2004 08:00 AM


All times are GMT -5. The time now is 11:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration