Related articles |
---|
Re: C++ intermediate representation. mefrill@yandex.ru (2005-05-15) |
RE: C++ intermediate representation. quinn-j@shaw.ca (Quinn Tyler Jackson) (2005-05-15) |
RE: Language Design Principles, was C++ intermediate representation. rabbit@thehole.com (Tom) (2005-05-16) |
RE: Language Design Principles, was C++ intermediate representation. nmm1@cus.cam.ac.uk (2005-05-16) |
Re: Language Design Principles, was C++ intermediate representation. rbates@southwind.net (Rodney M. Bates) (2005-05-18) |
Re: Language Design Principles, was C++ intermediate representation. nmm1@cus.cam.ac.uk (2005-05-18) |
Re: Language Design Principles, was C++ intermediate representation. rbates@southwind.net (Rodney M. Bates) (2005-05-19) |
Re: Language Design Principles, was C++ intermediate representation. rweaver@ix.netcom.com (Dick Weaver) (2005-05-19) |
From: | nmm1@cus.cam.ac.uk (Nick Maclaren) |
Newsgroups: | comp.compilers |
Date: | 16 May 2005 14:28:37 -0400 |
Organization: | University of Cambridge, England |
References: | 05-05-114 05-05-130 05-05-132 |
Keywords: | C++, parse, design |
Posted-Date: | 16 May 2005 14:28:37 EDT |
Tom <rabbit@thehole.com> writes:
|> I am reminded of Wirth's famous quote: "A language that is simple to
|> parse for the compiler is also simple to parse for the human programmer,
|> and that can only be an asset."
|>
|> [Wirth made many pithy comments, some of which have held up better in
|> practice than others. It's often been noted that using a semicolon to
|> separate statements as in Algol and Pascal is elegant but error prone,
|> while using them to terminate statements as in PL/I and C is ugly but
|> matches the way we think. Or, for a particularly egregious example,
|> perl has its usability faults, but the difficulty of parsing it is
|> down in the noise. -John]
Correct. One of my mental designs includes some useful language
features which are easily parsable by computers but a nightmare for
humans. Consider a statement-based language, where the syntax is
defined by a set of regular expressions and you can extend it by
adding your own (subject to a few orthogonality and precedence rules).
I don't mean SOME of the syntax - I mean ALL of the syntax. Yes, LISP
was there first :-)
'Twouldn't be hard to do with a recursive descent parser and lexical
analyser - integers with the digits backwards (but only in some
contexts) and pseudo functions that deliver syntactic separators
depending on the values of a (run-time) argument are merely two of the
more obvious, er, uses. You can, of course, do something similar to
the second with the C preprocessor.
Regards,
Nick Maclaren.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.