Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3790064
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:15:21+00:00 2026-05-19T12:15:21+00:00

I have absolutely no background in compilers and started off on a "teach myself"

  • 0

I have absolutely no background in compilers and started off on a "teach myself" journey. I am learning about lex using this tutorial and typed something like this into a file called first.l

%%
    /* match everything except newline */
.   ECHO;
    /* match newline */
\n ECHO;

%%

int yywrap(void) {
    return 1;
}

int main(void) {
    yylex();
    return 0;
}

Now I understand that lex is supposed to generate a tokenizer that will just echo everything it gets using the above first.l file. I went ahead and ran

lex first.l

It created a file called lex.yy.c. The tutorial then gives a few more examples and jumps to yacc. Can someone tell me what can be done with lex.yy.c file that is generated by lex? My thought was that I now have a tokenizer but how do I compile this file to a binary now? Using gcc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:15:21+00:00Added an answer on May 19, 2026 at 12:15 pm

    Yes, using GCC. You probably want to do something like this:

    gcc -c file1.c
    gcc -c file2.c
    gcc -o result file1.o file2.o
    

    The -c flag to GCC tells it not to link, but stop after generating an object file. Once you’ve compiled all the files, you can link it together by passing them all to gcc.

    So in your case, you would just go ahead and compile the output file generated by lex to get the binary:

    gcc -o output lex.yy.c
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have an absolutely positioned div containing several children, one of which is a
I have an image(a map) with some points of interest placed using position: absolute
I'm using php and I have the following code to convert an absolute path
I know that the title is very subtle but I have absolutely no idea
First, a little background : I have written a little application in python with
I have an iPhone application using UINavigationController and would like to customize the elements
I have a centered layout using margin:0 auto; , but one of my child
I have the following css code: #Layer3 { position:absolute; width: 89%; height: 40%; left:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.