parsingcompiler-constructiongrammartop-down

Parsing, which method choose?


I'm working on a compiler (language close to C) and I've to implement it in C. My main question is how to choose the right parsing method in order to be efficient while coding my compiler.

Here's my current grammar: http://img11.hostingpics.net/pics/273965Capturedcran20130417192526.png

I was thinking about making a top-down parser LL(1) as described here: http://dragonbook.stanford.edu/lecture-notes/Stanford-CS143/07-Top-Down-Parsing.pdf

Could it be an efficient choice considering this grammar, knowing that I first have to remove the left recursive rules. Do you have any other advices?

Thank you, Mentinet


Solution

  • The most efficient parsers are LR-Parsers and LR-parsers are bit difficult to implement .You can go for recursive descent parsing technique as it is easier to implement in C.