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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:57:39+00:00 2026-05-30T05:57:39+00:00

This is not exactly a question, because in this moment I’m not able to

  • 0

This is not exactly a question, because in this moment I’m not able to arrange in my mind a precise question to ask. It is more a collection of loud voice thoughts that I want to share with the other members, in order to fix my doubts.
I’m trying to implement an autocompleter for JavaScript. DON’T waste your time saying to me that is impossible to have a full autocompleter for a not statically typed programming languate. I already know it.
What I want is a small autocompleter that if I define something like that:

var a = {
b: { first: "goofy",second: 5},
c: "minnie"};

if (a.b.second > 0)
   a.s = 0;
else
   a.t = "honey";

when I digit a. the autocompleter should show me b,c,s,t.
I spent the last month to learn how to parse things using the material provided by compiler course at stanford university http://www.stanford.edu/class/cs143/.
Now I’m a little confuse. Obviously if I had to create a compiler I would use a LALR grammar and tools like flex&bison. But autocompleter it’s a different stuff. It’s interactive. While you are typing you have not the complete code and the line that you are typing in a single momente is not a valid sentece in a programming language. If I’m typing a. a LALR parser will say that is not able to reduce the sentence to the starting production. That means that is not fully able to parse what I wrote till this moment. But in any case I have to parse the sentence in order to show what members are inside “a”.
If I have well understood LALR parsing is lazier than LL. LALR is trying to collect as much lexemes as possible before applying a reduction. So I have the impression that LALR is the right choice for a compiler but LL is better for an autocompleter (if the programming language you are going to parse has an LL grammar, obviously). Is it correct?
Sorry I know that my post is confusing but in this moment I have the same confusion in my mind and I hope someone can help me to clear up the mess I have in my brain. I’m looking for someone with some kind of experience in writing autocompleter that could give me some small and usefull hints.

  • 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-30T05:57:42+00:00Added an answer on May 30, 2026 at 5:57 am

    I’d say that it will not matter if you’d use a LALR or a LL parser to achieve this. Regardless of the choice of generator, the key issue will be that the parser is robust enough to handle errors in a meaningful way.

    Since you will feed your parser incomplete input continuously, it must be able to recover from errors in a stable fashion without giving up. Typically an easy solution is that when you find an error you ignore tokens until you can reach an understandable state again. In JS I guess the best way would be to eat tokens until you get a ; or a }. From which you continue parsing again as if the error never happened. Bison actually handles this situation quite well, take a look at the error handling documentation.

    The autocompleter itself is basically a walk of the symbol table from any given point. As you correctly identifier, it’s impossible to do a complete autocompleter since the language isn’t statically typed, but you can at least know what has been statically declared at a given point.

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

Sidebar

Related Questions

I'm not exactly sure how to ask this question really, and I'm no where
This is not exactly a straight-out question because I have just solved it, but
This is not exactly a programming question, but it's highly related. We are writing
My question is not exactly the same as this one (it's not theoretical, there
Not sure exactly how to word this question ... so edits are welcomed! Anyway
I know this may not be exactly a coder question, but I feel it
This is not properly a question but something more like a thought I had
This is not exactly a technical question, since I know C kind of enough
Read this question carefully because I am not asking how to get rid of
This might not be exactly a programming question but it is related to programmers

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.