comp.lang.ada
 help / color / mirror / Atom feed
From: MFELDMAN@GWUVM.BITNET (Mike Feldman)
Subject: strange syntax
Date: Tue, 22-Sep-87 14:15:00 EDT	[thread overview]
Date: Tue Sep 22 14:15:00 1987
Message-ID: <8709221742.AA09055@ucbvax.Berkeley.EDU> (raw)

========================================================================
Dave Emery writes:


>Here's a real ada-guru question:
>Is the following program (syntactically) legal?
>  package demo is
>    max_val : constant := 15;
>    -- check the next declaration out carefully...
>   foo : integer range 1 .. max_val +1:= 15;
>   -- some compilers complain right  ^ there, and say that 1: is not
>   -- a legal literal, and then i get all kind of errors...
> end demo;
>It's obvious from reading the program what is meant, but must a
>parser be able to determine that +1: breaks down to 3 tokens, "+", "1"
>and ":="?


This looks really quirky to me. I tried it with four compilers: Meridian
1.5, Ada/Ed-PC, TeleSoft 3.1.3 VMS and Verdix 5.4.1 Sun. _All_ rejected
the program, typically with some "bad literal" message, with or without
further propagation. Oddly enough, _all_ accepted the program if a
blank was put after the 1 but before the colon! (i.e. +1 := ).

I cannot imagine a context for : in that position that's not going to
be a := - are there any syntax buffs out there who can explain just what
is ambiguous in that context?

             reply	other threads:[~1987-09-22 18:15 UTC|newest]

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

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