|How to parse and call c++ constructors? email@example.com (Groleo) (2005-09-17)|
|Re: How to parse and call c++ constructors? Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2005-09-18)|
|Re: How to parse and call c++ constructors? Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2005-09-22)|
|Re: How to parse and call c++ constructors? firstname.lastname@example.org (A Pietu Pohjalainen) (2005-09-22)|
|Re: How to parse and call c++ constructors? DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-09-22)|
|Re: How to parse and call c++ constructors? email@example.com (Groleo) (2005-09-22)|
|Re: How to parse and call c++ constructors? cfc@shell01.TheWorld.com (Chris F Clark) (2005-09-23)|
|Date:||22 Sep 2005 23:38:35 -0400|
|Keywords:||C++, parse, LL(1)|
|Posted-Date:||22 Sep 2005 23:38:35 EDT|
Detlef Meyer-Eltz wrote:
> here a week ago: the integration of semantic code in LL-parsers is a
> very intuitive task. Your example could be implemented by the
That's true. Niklaus Wirth demonstrated this in his first book on
compiler construction in 1976. I have never understood why the
majority of language designers ignored the simplicity of LL(1) parsing
and designed their languages so that they needed more complicated
parsers during compilation. Niklaus Wirth once suggested that a
Language Designer should always be forced to write the first parser
implementation for a newly created language all by himself. This
experience would educate him.
Apart from this, the C++ code given by the OP demonstrates one more
shortcoming of 'modern OO-style parser design'. Developers wonder how
to "call c++ constructors". But they ignore the destructors. The vast
majority of C++ developers (not only compiler developers) invests time
in writing proper OO-style constructors, but they write faulty and
incomplete destructors. That's the reason why we can observe
- memory leaks wherever we look
- crashes and core dumps are commonplace
You may argue that "modern languages like Java" don't have this
problem because they have Garbage Collection in their laguages design.
I have really heard this argument many times from people justifying
their choice of Java. These people are too stupid to write proper C++
destructors (some even too stupid to write proper C++ constructors),
but they are smart enough to switch over to Java. With Java, the
situation becomes even worse for them.
1. It is still possible to have memory leaks in Java.
2. Such languages loose the ability to satisfy real-time constraints.
Return to the
Search the comp.compilers archives again.