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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:37:45+00:00 2026-05-18T12:37:45+00:00

Preamble I have written GLR-parser with error recovery. When it encounters an error it

  • 0

Preamble

I have written GLR-parser with error recovery. When it encounters an error it splits into following alternatives:

  1. Insert the expected element into input (may be the user just missed it) and proceed as usual.
  2. Replace the erroneous element with expected one (may be the user just made a mistype) and proceed as usual.
  3. Skip erroneous element and if next element is also erroneous then go to #2.

But if input has a lot of errors (for example, user has by mistake given JPEG file to the parser) a number of alternatives grows exponentially.

Example

Such a parser corresponding to the following grammar:

Program -> Identifier WS Identifier WS '=' WS Identifier
Identifier -> ('a'..'z' | 'A'..'Z' | '0'..'9')*
WS -> ' '*

applied to the following text:

x = "abc\"def"; y = "ghi\"jkl";

fails with “out of memory” on moderately modern desktop computer.

Question

How to reduce number of alternatives in case of errors in input?

  • 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-18T12:37:45+00:00Added an answer on May 18, 2026 at 12:37 pm

    Doing GLR (parsing therefore) error correction at the character level is possible but aggravates your problem.

    The GLR error recovery procedure we use operates on tokens, so it isn’t as bad.

    But when the input has a huge number of errors, it is pretty hard to recover. More sophisticated error recovery schemes basically use the parser to identify valid substrings of the language in the input, and then attempts to patch the substrings together to get the result. That’s pretty ambitious.

    I’ve built GLR parsers with error recovery. I wasn’t that ambitious. In general
    the parser mostly just aborts when the number of live parsers gets above “a large number” (e.g., 10,000) or the number of syntax errors encountered exceed a threshold (e.g, 10 or 20). You might consider aborting the parser if it hasn’t advanced the input stream in the last second, which is an indirect sign it has too many live parsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Preamble To build dynamic web-sites, we have to master at least four languages: HTML
Small preamble. I was good java developer on 1.4 jdk. After it I have
The preamble: I have designed a strongly interfaced and fully mockable data layer class
Without any preamble I want to show you problem I have in my program,
Preamble: I know, disabling warnings is not a good idea. Anyway, I have a
I have the following LaTeX file. Notice how the item on the description is
I have some XML that I'm parsing with a SAX parser in Java. It
I have the following YAML: - name: List of monkeys - author: Nicolas Raoul
Preamble: This is very close to this question , and I have read this
I am trying to add a simple figure into my latex code .I have

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.