解析,哪种方法选择?(Parsing, which method choose?)

系统教程 行业动态 更新时间:2024-06-14 17:04:03
解析,哪种方法选择?(Parsing, which method choose?)

我正在研究一种编译器(接近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.

更多推荐

本文发布于:2023-04-24 21:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/4f7ec70a431b0966a3966d73e5cb0893.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:哪种   方法   Parsing   method   choose

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!