| Related articles |
|---|
| From: | Ian Lance Taylor <ianlancetaylor@gmail.com> |
| Newsgroups: | comp.compilers |
| Date: | Sat, 22 Jan 2022 15:40:02 -0800 |
| Organization: | Compilers Central |
| References: | 22-01-059 22-01-083 22-01-090 |
| Injection-Info: | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="73989"; mail-complaints-to="abuse@iecc.com" |
| Keywords: | parse, tools |
| Posted-Date: | 22 Jan 2022 18:51:45 EST |
| In-Reply-To: | 22-01-090 |
On Sat, Jan 22, 2022 at 3:26 PM Roger L Costello <costello@mitre.org> wrote:
>
> They ignored the rich theory and vast set of algorithms, in favor of their
> own
> proprietary code? Why would the C++ compiler developers do such a thing?
>
> /Roger
> [My guess is that they were too busy chopping down trees to sharpen their
> axes. -John]
>
The change in GCC away from using bison to a recursive descent parser was a
considered decision on the part of the GCC C++ maintainers. I believe that
the project started at
https://gcc.gnu.org/legacy-ml/gcc/2000-10/msg00573.html and it was
committed to the tree in December, 2002.
In my experience bison/yacc parsers are really good for knowing the exact
language that you are parsing. But it is difficult to make them generate
good error messages and it is difficult to debug them. A language like C++
can only be parsed in conjunction with a symbol table, because the parsing
depends on the semantic meaning of tokens; that too is difficult to do
using yacc. So while I agree that yacc parsers are theoretically superior,
I believe that experience shows that they have some problems in practice.
In fact, I would be interested in knowing whether there is any generally
used C++ compiler that uses a yacc parser. For example, clang also uses a
recursive descent parser.
Ian
Return to the
comp.compilers page.
Search the
comp.compilers archives again.