Is GCC a LALR(1) compiler?
Can anyone deny/co开发者_开发百科nfirm this??
It can't be, at least not entirely -- the C grammar doesn't fit LALR(1).
http://gcc.gnu.org/ml/gcc-help/2004-08/msg00099.html
The Gcc parser is a LALR grammar file for Bison, which is a LALR parser generator. Therefore, if you want to say that, gcc is LALR.
Yes, GCC is LALR.
"The Gcc parser is a LALR grammar file for Bison, which is a LALR parser generator. Therefore, if you want to say that, gcc is LALR."
This discussion (though old) says gcc is LALR while for C++ it is a hand-written recursive descent one.
The quote above is out of date. All parser of GCC is hand written now. And I am pretty sure cpp is a lalr(k) parser.
精彩评论