Re: Why context-free?

nmm1@cus.cam.ac.uk (Nick Maclaren)
26 Oct 2005 14:24:06 -0400

          From comp.compilers

Related articles
[19 earlier articles]
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-19)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-19)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-20)
Re: Why context-free? find@my.address.elsewhere (Matthias Blume) (2005-10-23)
Re: Why context-free? lhp+news@toft-hp.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen) (2005-10-23)
Re: Why context-free? stephen@dino.dnsalias.com (2005-10-23)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-26)
Re: Why context-free? wyrmwif@tsoft.org (SM Ryan) (2005-10-26)
Re: Why context-free? henry@spsystems.net (2005-10-26)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-27)
Re: Why context-free? dot@dotat.at (Tony Finch) (2005-10-27)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-29)
Re: Why context-free? henry@spsystems.net (2005-10-29)
[1 later articles]
| List of all articles for this month |

From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Newsgroups: comp.compilers
Date: 26 Oct 2005 14:24:06 -0400
Organization: University of Cambridge, England
References: 05-10-053 05-10-109 05-10-131 05-10-150
Keywords: parse, design
Posted-Date: 26 Oct 2005 14:24:06 EDT

Matthias Blume <find@my.address.elsewhere> wrote:
>nmm1@cus.cam.ac.uk (Nick Maclaren) writes:
>
>> However, my experience is that most people think in a context-full
>> fashion, and so there is a strong argument for designing a language
>> where controlled aspects of the context are first-class parts of the
>> syntax.
>
>I agree with the premise, but I don't understand how you derive the
>conclusion from it. Context-sensitive aspects of programming
>languages are routinely handled by subsequent passes (type checking,
>elaboration, etc.) There is no particularly good reason to move this
>stuff into the parser, and there are several good reasons (which
>people here have already enumerated) for not doing so.


The fact that there is a strong argument in favour of A doesn't mean
that there aren't even stronger arguments against it! All is means is
that A shouldn't be rejected without good reason.


My logic is that it is often necessary to play revolting games in
conventional languages to get around restrictions imposed by the
syntax, often in ways that could quite easily be relaxed. Most such
relaxations are best done in a context-free fashion, I agree (why
complicate things?), but some aren't.


Something that has been forgotten by some of the language community is
that the conventional approach is just that. It has become
conventional because it has a good theory behind it that maps fairly
well into practice, but that doesn't mean that it is the only
worthwhile approach. Designing languages and writing compilers is
like writing tribal lays - see Kipling :-)


Regards,
Nick Maclaren.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.