[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] INTEGER CARDINAL compatibility - little follow up
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] INTEGER CARDINAL compatibility - little follow up |
Date: |
23 Feb 2008 15:06:18 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Hi Andreas,
many thanks for clarifying up these queries and also for the manual
and test code. Yes the code is useful,
regards,
Gaius
Andreas Fischlin <address@hidden> writes:
> Dear Gaius,
>
> Attached Wirth et al., 1992, the MacMETH manual, may be useful for you
> to look at PIM issues. Lot's is written from the perspective of a
> compiler builder. In case you should be interested, I can give you all
> sources of the MacMETH compiler.
>
> Note, apart from the 1-pass restrictions and the exotic solution for
> LONGINT, LONGCARD and LONGREAL constants (Ex.: CONST lintc = 2D;
> lrealc = 1.2D-4;). It can also be found at
> http://www.sysecol.ethz.ch/SimSoftware/RAMSES/MacMETH.html
> resp.
> http://www.sysecol.ethz.ch/SimSoftware/RAMSES/Documents/MacMETH_Manual.pdf
>
> The other attachment is littel test program that's compilable with our
> latest MacMETH compiler, yet results of course in a run-time error
> towards the end. Should be self eplanatory.
>
> Regards,
> Andreas
>
>
> Cited references:
> ----------------
> Wirth, N., Gutknecht, J., Heiz, W., Schär, H., Seiler, H., Vetterli,
> C. & Fischlin, A., 1992. MacMETH. A fast Modula-2 language system for
> the Apple Macintosh. User Manual. 4th, completely revised ed. User
> Manual Department of Computer Sciences (ETH), Zürich, Switzerland, 116
> pp.
>
>
> Gaius Mulley wrote:
> > Hi,
> >
> > I'm in the middle of correcting the compatibility between INTEGERs
> > and CARDINALs during assignment, expression, parameter passing
> > and INC and DEC. (With appropriate runtime range checking).
> >
> > I see from PIM4 and ISO that mixed expressions using an INTEGER
> > and CARDINAL variable are disallowed. But I couldn't find whether
> > this also includes:
> >
> > MODULE foo ;
> > VAR
> > i: INTEGER ;
> > c: CARDINAL ;
> > BEGIN
> > IF i>c
> > THEN
> >
> > END
> > END foo.
> >
> > from my reading is that this is illegal according to ISO and PIM, but
> > this does seem restrictive.. I was just wondering whether I'd missed
> > something, or misinterpreted something?
> >
> > Conversely its my understanding that:
> >
> > DEC(c, i) (* legal providing 0 <= i <= MAX(CARDINAL)
> > (* the later always true for i *) *)
> >
> > and DEC(i, c) (* legal providing 0 <= c <= MAX(INTEGER) *)
> >
> >
> > regards,
> > Gaius
> >
> >
> > _______________________________________________
> > gm2 mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/gm2
> >
>
> --
> <pre>________________________________________________________________________
> Andreas Fischlin, Ph.D., Group Director
>
> Terrestrial Systems Ecology
> Institute of Integrative Biology: Ecology, Evolution, Infectious Disease
> Department of Environmental Sciences, ETH Zurich
>
> Address:
> ETH Zurich, CHN E35.1
> 8092 Zurich, Switzerland
>
> Phone: +41 44 633-6090 / Fax: +41 44 633-1031
> http://www.sysecol.ethz.ch/Staff/af/
> http://www.sysecol.ethz.ch/
>
> _/_/_/ _/_/_/ _/ _/
> _/ _/ _/ _/ Eidgenoessische Technische Hochschule Zuerich
> _/_/_/ _/ _/_/_/ Swiss Federal Institute of Technology Zurich
> _/ _/ _/ _/ Ecole polytechnique federale de Zurich
> _/_/_/ _/ _/ _/ Politecnico federale de Zurigo
>
> Make it as simple as possible, but distrust it!
> ________________________________________________________________________
> </pre>