From: Grzegorz J. <ja...@he...> - 2003-04-26 06:22:27
|
On Sat, 26 Apr 2003, Shigeru Chiba wrote: > > Hi Larry, > > Date: Fri, 25 Apr 2003 12:23:53 -0600 > From: Larry Evans <jca...@pr...> > To: op...@cs... > Subject: why no compiler-compiler to gen occ? > > > After downloading 2.6.1 and looking at the source files, I noticed > > there's no use of any kind of compiler-compiler such as antlr or > > yacc. The source code in parse.h looks like it could be generated > > by antlr (since it's recursive decent); hence, I'm wondering why > > antlr or something like it wasn't used. In "Design&Evolution" Stroustrup admits that using YACC for Cfront implementation was a mistake and gave him lots of headaches. Regards Grzegorz > > The reason is simple. Yacc, LALR(1), cannot parse C++ programs > without awkward tricks of the lexical analyzer. ANTLR was not very > popular when OpenC++ was written in around 1995 (at least, I didn't > know it.) The final reason is that writing an LL(k) with-back-tracking > parser by hand is easy. At that time, I thought I should not have > wasted time for finding some nice compiler-compiler but started > writing a parser by hand. > > If I rewrite OpenC++ today, hmm.. I might use ANTLR. I don't know. > > Chiba > > ################################################################## # Grzegorz Jakacki Huada Electronic Design # # Senior Engineer, CAD Dept. 1 Gaojiayuan, Chaoyang # # tel. +86-10-64365577 x2074 Beijing 100015, China # # Copyright (C) 2002 Grzegorz Jakacki, HED. All Rights Reserved. # ################################################################## |