* Help with Meridian compiler, please
@ 1993-02-04 14:42 Angel Alvarez
0 siblings, 0 replies; 4+ messages in thread
From: Angel Alvarez @ 1993-02-04 14:42 UTC (permalink / raw)
The following simple program fails to compile with the PC Meridian compiler
(both 286 and 386):
procedure w is
a: NATURAL range 0..1:=0;
begin
null;
end w;
However, with the addition of one blank space, it compiles OK:
procedure w is
a: NATURAL range 0..1 :=0;
-----------------------^
begin
null;
end w;
Am I facing a (super) weak scanner? ... Am I missing something too obvious?
(anybody from Meridian out there?)
Thanks,
Angel Alvarez
DIT (B-312)
E.T.S.I. Telecomunicacion
Technical University of Madrid
E-28040 Madrid SPAIN
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help with Meridian compiler, please
@ 1993-02-05 15:38 Robert I. Eachus
0 siblings, 0 replies; 4+ messages in thread
From: Robert I. Eachus @ 1993-02-05 15:38 UTC (permalink / raw)
In article <1993Feb4.144224.7460@goya.uu.es> aalvarez@dit.upm.es (Angel Alvarez
) writes:
> a: NATURAL range 0..1:=0;
Ooooh Ouch! Tricky syntax analyzer test! To make it harder use
A: Natural range 0..2:=0;
The reason Meridan trips up (and yes it is a compiler bug) is
probably that 2:1101: is a legal numeric literal (with a decimal value
of 13). I suspect that the compiler starts reading with the syntax of
an integer literal and when that fails backs up incorrectly, reading
the value 1 correctly but losing the colon.
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help with Meridian compiler, please
@ 1993-02-05 17:04 cis.ohio-state.edu!news.sei.cmu.edu!firth
0 siblings, 0 replies; 4+ messages in thread
From: cis.ohio-state.edu!news.sei.cmu.edu!firth @ 1993-02-05 17:04 UTC (permalink / raw)
In article <EACHUS.93Feb5103840@dr_no.mitre.org> eachus@dr_no.mitre.org (Robert
I. Eachus) writes:
> A: Natural range 0..2:=0;
>
> The reason Meridan trips up (and yes it is a compiler bug) is
>probably that 2:1101: is a legal numeric literal (with a decimal value
>of 13).
I think you're right. This situation requires a two-character lookahead,
which is a problem with some scanners, especially machine-generated ones.
Also, unlike the almost-ambiguous 'X (attribute or character literal?),
the left syntactic context is no help.
The solution, of course, is to do the two-character lookahead. My own
disgusting hack, on finding "2:=", is to put back just one character, a
synthetic lexical token that means ":=", and then we're back in sync.
Odd, though, that it should fail on the colon, having already solved
the identical problem of distinguishing between a range starting "0."
and a real constant starting "0.".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help with Meridian compiler, please
@ 1993-02-06 23:24 darwin.sura.net!sgiblab!news.cs.indiana.edu!arizona.edu!east.pima.edu!rha
0 siblings, 0 replies; 4+ messages in thread
From: darwin.sura.net!sgiblab!news.cs.indiana.edu!arizona.edu!east.pima.edu!rha @ 1993-02-06 23:24 UTC (permalink / raw)
In article <1993Feb4.144224.7460@goya.uu.es>, aalvarez@dit.upm.es
(Angel Alvarez) writes:
> The following simple program fails to compile with the PC Meridian compiler
> (both 286 and 386):
>
> procedure w is
> a: NATURAL range 0..1:=0;
> begin
> null;
> end w;
Never quite saw this one before! The hint is in the actual error message
generated (which often is helpful to include when posting to such a wide
audience): "illegal base in numeric literal". Understanding the source of the
error is not trivial! First, you must remember from LRM 2.10/3 that "sharp
characters (#) of a based literal can be replaced by colons (:)...". The
compiler "thinks" you are about to supply a based literal as the endpoint of
the range, perhaps something like 16#FFF#, only you've "chosen" to substitute
colons like 16:FFF: . The lexer probably doesn't look FIRST for the entire
syntactic construct for a based literal before deciding that it really IS what
you intended.
Next time I'm on the phone with them, I'll pass this along!
-----
Ray Harwood |Data Basix |Adjunct Faculty, East Campus,
Voice: (602)721-1988 |PO Box 18324 | Pima Community College
FAX: (602)721-7240 |Tucson, AZ 85731 |Instructor in Ada and Pascal
CompuServe: 76645,1370|AppleLink: DATA.BASIX|Internet: rharwood@east.pima.edu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1993-02-06 23:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-02-05 15:38 Help with Meridian compiler, please Robert I. Eachus
-- strict thread matches above, loose matches on Subject: below --
1993-02-06 23:24 darwin.sura.net!sgiblab!news.cs.indiana.edu!arizona.edu!east.pima.edu!rha
1993-02-05 17:04 cis.ohio-state.edu!news.sei.cmu.edu!firth
1993-02-04 14:42 Angel Alvarez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox