GCC 和 Clang 解析器真的是手写的吗? [英] Are GCC and Clang parsers really handwritten?
问题描述
似乎 GCC 和 LLVM-Clang 正在使用手写递归下降解析器,并且不是机器生成的、基于 Bison-Flex 的自底向上解析.
It seems that GCC and LLVM-Clang are using handwritten recursive descent parsers, and not machine generated, Bison-Flex based, bottom up parsing.
这里有人可以确认是这样吗?如果是这样,为什么主流编译器框架使用手写解析器?
Could someone here please confirm that this is the case? And if so, why do mainstream compiler frameworks use handwritten parsers?
更新:有关此主题的有趣博客
推荐答案
是:
GCC 曾经使用过一个 yacc(bison)解析器,但在 3.x 系列的某个时候它被一个手写的递归下降解析器所取代:见 http://gcc.gnu.org/wiki/New_C_Parser 提供相关补丁提交的链接.
GCC used a yacc (bison) parser once upon a time, but it was replaced with a hand-written recursive descent parser at some point in the 3.x series: see http://gcc.gnu.org/wiki/New_C_Parser for links to relevant patch submissions.
Clang 还使用了手写的递归下降解析器:请参阅 http://clang.llvm.org/features.html .
Clang also uses a hand-written recursive descent parser: see the section "A single unified parser for C, Objective C, C++ and Objective C++" near the end of http://clang.llvm.org/features.html .
这篇关于GCC 和 Clang 解析器真的是手写的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!