From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!zen!ucbvax!GWUVM.BITNET!MFELDMAN From: MFELDMAN@GWUVM.BITNET (Mike Feldman) Newsgroups: comp.lang.ada Subject: strange syntax Message-ID: <8709221742.AA09055@ucbvax.Berkeley.EDU> Date: Tue, 22-Sep-87 14:15:00 EDT Article-I.D.: ucbvax.8709221742.AA09055 Posted: Tue Sep 22 14:15:00 1987 Date-Received: Thu, 24-Sep-87 05:39:05 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: ======================================================================== 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?