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 7416555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:31:13+00:00 2026-05-29T07:31:13+00:00

I need some advice about writing a parser (using C and Lex) that accepts

  • 0

I need some advice about writing a parser (using C and Lex) that accepts a CFG and removes left recursion. Since the parser, needs to accept any string and a grammer, I am clueless about how to start. Although I am familiar with the algorithm to remove left recursoin (as mentioned here, I am clueless about how to start, and what will be the data structures involved. What is the best way to store the grammar, and the string. And how can I efficiently apply the algorithm. Please suggest. (Since this is homework, please do not provide me the code, instead any other help/pseudocode shall do) 🙂

  • 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-29T07:31:14+00:00Added an answer on May 29, 2026 at 7:31 am
    1. You need to define a grammar P that describes grammars. This should be pretty easy.
    2. You need to build a parser for P. It needn’t be complicated, because P won’t be complicated. Trust me. You can use this method to hand-code a recursive-descent parser: https://stackoverflow.com/a/2336769/120163
    3. As P parses, it build up a data structure representing the grammar.
      Such a data structure needs to record, for each rule, its left side, its length, and the tokens the comprise the rule body.
    4. At this point, you’ve collected the rules in the data structure, and now you need to apply your left recursion algorithm by adjusting the rules.
    5. Finally you need to print out the rules; they should reappear in the syntax you chose for P.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some advice from experts :) I will develop a website using PHP
We are writing a socket server in c# and need some advice on the
please I need some advice about design approaches in iPhone programming. I want to
I need some advice about how to logically proceed to limit the use of
I need some advice on how to go about a particular issue I'm trying
I need some implementation advice. I have a MYSQL DB that will be written
I am delving into domain events and need some advice about persisting updates to
I need some advice on a project that I am going to undertake. I
Need some advice about a best-approach for this problem: I've fallen madly in love
I need some advice how to go about this: 1) I retrieve an XML

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.