comp.lang.ada
 help / color / mirror / Atom feed
From: jankok@cwi.nl (Jan Kok)
Subject: Re: Strange syntax
Date: Thu, 24-Sep-87 05:12:15 EDT	[thread overview]
Date: Thu Sep 24 05:12:15 1987
Message-ID: <362@zuring.cwi.nl> (raw)
In-Reply-To: 8709231753.AA26614@q.sei.cmu.edu

In article <8709231753.AA26614@q.sei.cmu.edu> Kenneth.Lee@SEI.CMU.EDU writes:
>
>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;
>
> ...
Well, this is not an explanation of course. It only says that there is a
reformatter that solves correctly the ambiguity with the ':'.
I wish to contribute to the discussion (the example is correct Ada) that
the colon is not the only ambiguous character where the difficulties have
been overlooked by some of the compiler writers. And apparently also by
the composers of the ACV suite, since we are talking avout validated
compilers.

Period, prime, quotation mark and minus may be used to construct other
teasers. A try:

   PUT(A.all'FIRST);

   PUT(B.all(1)'LAST);

   C := B--- comment
   - D; -- or
   C := B--- comment
   D;

   procedure TT is
     function "*"(A, B:INTEGER) return INTEGER is
       subtype INT is INTEGER;
       C :"*".INT:=3;
       D :TT."*".INT:=4;
       E:SYSTEM.ADDRESS:= TT."*"'ADDRESS;
       -- with these declarations, the following example has been on the
       -- net recently:
       procedure WRITE ( X:"*".INT) is
       begin null; -- or something
       end;
     begin C:="*".INT'LAST;
       return (A*"*".INT'(B));
     end"*";
   begin null; end TT;

But who should write real life code like this? :-)
    Jan Kok.
-- 
Mail: Jan Kok, CWI (afd. NW), Postbus 4079, NL-1009 AB Amsterdam, Nederland
Net : jankok@cwi.nl
               It was twenty years ago today,
               Sgt. Pepper taught the band to play,

  reply	other threads:[~1987-09-24  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-09-23 17:53 Strange syntax Kenneth.Lee
1987-09-24  9:12 ` Jan Kok [this message]
  -- 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