comp.lang.ada
 help / color / mirror / Atom feed
From: Kenneth.Lee@SEI.CMU.EDU
Subject: Re: Strange syntax
Date: Wed, 23-Sep-87 13:53:10 EDT	[thread overview]
Date: Wed Sep 23 13:53:10 1987
Message-ID: <8709231753.AA26614@q.sei.cmu.edu> (raw)

> From: "GBURG::CWILLIAMS" <cwilliams%gburg decnet@bluto scc com>
> The Rational R1000 compiler also accepts the example as legal and does execute
> properly. Given the fact that DEC-Ada also accepts it, I would say that it is
> in fact legal Ada. The fact that other compilers reject it as erroneous 
> suggests to me that the example should be added to the ACVC if the final 
> determination is that the example is legal.
> 
> Chuck Williams
> CONTEL Federal Systems

The Rational R1000 compiles the code because the first step when a source
unit is promoted to an installed unit is to format the code.  The
reformatted code for the line in question is:
	Foo : Integer range 1 .. Max_Val + 1 := 15;

The following, recent post on the SEI bboard from Robert Firth provides an
explanation for the compiler diagnostics.

22-Sep-87 17:52    Robert Firth@sei cmu edu     1:= syntax error
The problems with "1:=" generating an error can be traced to
[RM 2.4.2 - Based Literals] and [RM 2.10 - Allowable Replacements of
Characters].

The compiler believes that the sequence "1:" introduces a based literal,
for instance "1:0123:".  Accordingly, it fails on the "=" character,
which cannot be part of a based literal.

Recall that, while based literals are usually written "2#1010#", the
colon is an allowable replacement for the hachure.  You should expect
various error messages, such as "illegal char in based literal",
"invalid base in based literal", and so on.

This lexis is correct according to the RM - indeed, any alternative
would no longer be LR(1) and so would cause trouble for automatic
scanner generators.  And the colon is a replacement character because
Steelman required that Ada be representable using a 56-character set.

Sigh.

Robert


-----


Ken

             reply	other threads:[~1987-09-23 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-09-23 17:53 Kenneth.Lee [this message]
1987-09-24  9:12 ` Strange syntax Jan Kok
  -- strict thread matches above, loose matches on Subject: below --
1987-09-22 18:15 strange syntax Mike Feldman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox