|type or identifier fundamental parsing issue - Need help from parsing email@example.com (AD) (2012-07-03)|
|Re: type or identifier fundamental parsing issue - Need help from pars firstname.lastname@example.org (George Neuner) (2012-07-04)|
|Re: type or identifier fundamental parsing issue - Need help from pars DrDiettrich1@aol.com (Hans-Peter Diettrich) (2012-07-04)|
|Re: type or identifier fundamental parsing issue - Need help from pars email@example.com (2012-07-11)|
|DKIM-Signature:||v=1; a=rsa-sha256; c=simple; d=iecc.com; h=cc:from:subject:date:sender:message-id:references:mime-version:content-type:content-transfer-encoding:vbr-info; s=8ec9.4ff8a2d5.k1207; firstname.lastname@example.org; bh=tBWv0yg+SOjLIwpkEx6f6ZFkHb6dDVhZ/89M5YYy+xc=; b=uYlTbGNiPIdmGye82vNCxZHQzGyP/n+3n86fVd4s4XEXFhOre+qQrXSjy6AzW7EsAcyfIQp0KNPH/e+uMnYNStvuS9NemrYr9wDc8wB8Sanb5iK6nf1+CI9qoTcoCk5mKZaRm0jRLy/Z7/TAl9vckHeaSymlj68Z3EBF9r7Gg0M=|
|VBR-Info:||md=iecc.com; mc=all; mv=dwl.spamhaus.org|
|From:||George Neuner <email@example.com>|
|Date:||Wed, 04 Jul 2012 00:57:44 -0400|
|Organization:||A noiseless patient Spider|
|Keywords:||parse, types, practice|
|Posted-Date:||07 Jul 2012 16:57:57 EDT|
On Tue, 3 Jul 2012 11:30:48 -0700 (PDT), AD <firstname.lastname@example.org> wrote:
>I am dealing with a programming langauge that supports something like
>sizeof(<typename>) as well as sizeof(<variable-name>) expression.
>Problem is, this language supports certain constructs which can potentially
>later make such early lookup/resolution decisions wrong. In short, name
>resolutions in this langauge (as per the langauge definition) can only be
>initiated after the entire source code has been completely parsed/seen.
>Given this restriction, I will probably have to delay/defer the decision of,
>whether we saw a 'type' or a non-type variable (with the 'sizeof' operator) to
>"semantic check phase".
>On the other hand, some people/experts believe that such decisions of whether
>something is a type or non-type idernfier has to be frozen/finished during
>parsing and *SHOULD NOT* be deferred/delayed to 'semantic check phase'.
There are no hard and fast rules. There typically is efficiency to be
gained by classifying identifiers as early as is practical, but the
notion that such classification *must* be done at parse time simply is
ridiculous. Simply do whatever is most convenient.
That said, ambiguity such as you describe tends to make a language
complex and difficult for programmers to understand. This is not
necessarily a bad thing, but it should be justified by a measurable
gain in expressive power. Ambiguity introduced merely for brevity
(e.g., shorthand) or for the sake of clever features which have no
clearly beneficial use cases should be carefully examined to determine
whether the semantics provided are even useful or if they can be
expressed in a less confusing way.
Return to the
Search the comp.compilers archives again.