我正在研究一种编译器(接近C的语言),我将在C中实现它。我的主要问题是如何选择正确的解析方法,以便在编译编译器时有效。
这是我目前的语法: http : //img11.hostingpics.net/pics/273965Capturedcran20130417192526.png
我正在考虑制作一个自上而下的解析器LL(1),如下所述: http : //dragonbook.stanford.edu/lecture-notes/Stanford-CS143/07-Top-Down-Parsing.pdf
考虑到这种语法,它是否是一个有效的选择,因为我知道我首先必须删除左递归规则。 你还有其他建议吗?
谢谢你,Mentinet
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
最满意答案
最有效的解析器是LR-Parsers和LR解析器有点难以实现。您可以使用递归下降解析技术,因为它更容易在C中实现。
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.
更多推荐
发布评论