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

  • SEARCH
  • Home
  • 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

I have this JSF page: <div id=settingsdiv style=width:350px; height:400px; position:absolute; background-color:r; top:20px; left:1px> <h:form>
I have absolutely no idea how to do this, so I'm just gonna go
I have absolutely no idea why this is happening but the following code seems
I have some code that I absolutely must implement using goto . For example,
So I have this template design that is currently absolutely positioned, but I'm trying
I have tried for three days now and gotten nowhere on this.... I absolutely
I have this code & I've tired using JQuery's appendTo() function to get this
I have a html layout done using absolutely positioned div elements and a backgroung
I have an absolutely positioned div that has a width of 100% with a
I have an absolutely placed div with an embedded YouTube video inside of it.

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.