How to write a parser in C?

What are the ways to write a code for a bottom up parser from the given LR parser  code and compare their efficiencies?

  • Answer:

    If you have the LR parser code, then you already have a bottom-up parser, because LR works bottom-up ;) Did you mean top-down? The general answer is that the easiest way is most probably through the grammar. If you can extract it from the code that you have (by reusing the parser spec, by recovering it from the code structure, by looking at comments — whatever, the methods are plenty), then you can transform it (sometimes even automatically, depends on your knowledge of ) to have a suitable form for top-down (or for whatever your favourite parsing technology is), and then to generate it again from that grammar.

Vadim Zaytsev at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.