Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #706

Re: type or identifier fundamental parsing issue - Need help from parsing experts

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.bbs-scene.org!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end
From George Neuner <gneuner2@comcast.net>
Newsgroups comp.compilers
Subject Re: type or identifier fundamental parsing issue - Need help from parsing experts
Date Wed, 04 Jul 2012 00:57:44 -0400
Organization A noiseless patient Spider
Lines 33
Sender johnl@iecc.com
Approved comp.compilers@iecc.com
Message-ID <12-07-006@comp.compilers> (permalink)
References <12-07-004@comp.compilers>
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace leila.iecc.com 1341694677 36543 64.57.183.58 (7 Jul 2012 20:57:57 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Sat, 7 Jul 2012 20:57:57 +0000 (UTC)
Keywords parse, types, practice
Posted-Date 07 Jul 2012 16:57:57 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:706

Show key headers only | View raw


On Tue, 3 Jul 2012 11:30:48 -0700 (PDT), AD <hsad005@gmail.com> 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.

George

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

type or identifier fundamental parsing issue - Need help from parsing experts AD <hsad005@gmail.com> - 2012-07-03 11:30 -0700
  Re: type or identifier fundamental parsing issue - Need help from parsing experts George Neuner <gneuner2@comcast.net> - 2012-07-04 00:57 -0400
    Re: type or identifier fundamental parsing issue - Need help from parsing experts torbenm@diku.dk (Torben Ægidius Mogensen) - 2012-07-11 12:17 +0200
  Re: type or identifier fundamental parsing issue - Need help from parsing experts Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-07-04 11:43 +0100
    Re: C arcana, was type or identifier fundamental parsing issue - Need help from parsing experts "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-07-12 09:23 -0700

csiph-web