[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] ISO constant literal constructors implemented
From: |
Andreas Fischlin |
Subject: |
[Gm2] ISO constant literal constructors implemented |
Date: |
Fri, 18 Jan 2008 17:18:27 +0100 |
User-agent: |
Thunderbird 2.0.0.9 (Macintosh/20071031) |
Hi Gaius,
A Happy New Year and I can only say, great!
Regards,
Andreas
Hi,
I've just checked in the following changes which as the title suggests
implements ISO constant literal constructors. This should allow
sets, records and arrays to be initialised via a constant declaration.
So for example here is the test code found in
testsuite/gm2/iso/pass/constructor4.mod:
MODULE constructor4 ;
TYPE
colours = (red, green, blue) ;
position = RECORD
x1, y1, x2, y2: CARDINAL ;
END ;
rec = RECORD
col: colours;
pos: position ;
END ;
CONST
first = rec{green, position{2,3,4,5}} ;
VAR
second: rec ;
BEGIN
second := first
END constructor4.
and the ChangeLog follows:
* ISO conformant compound literal constructors have been
implemented.
* gm2/TODO: updated.
* gm2/gccgm2.c: added constructor type and build
functions to create ARRAY, RECORD and SET compound
constructors.
* gm2/bnf/m2-2.bnf: modified grammer to include compound
constructors and associated type build functions. Limited
compound literal type checking is also implemented.
* gm2/bnf/m2-3.bnf: modified grammer to include compound
constructors and to appropriate quadruple generation.
* gm2/bnf/m2-h.bnf: modified grammer to include compound
constructors during the hidden pass.
* gm2/gm2/bnf/m2.bnf: modified grammer to include compound
constructors.
* gm2/FifoQueue.def: extended to allow enumerations and
subranges to be stored and retrieved.
* gm2/FifoQueue.mod: implemented appropriately.
* gm2/gm2-compiler/M2ALU.def: major alterations to allow
constructors (ARRAY, RECORD and SET) constants to be
created at compile time and also be translated into GCC trees.
* gm2/gm2-compiler/M2ALU.mod: implemented above, more checking
to ensure that a RECORDs and ARRAYs cannot have bits included.
SETs cannot have fields initialized etc.
* gm2/gm2-compiler/M2GCCDeclare.mod: resolves all dependants
of compound literals and declares Modula-2 constructors to
their gcc tree counterpart.
* gm2/gm2-compiler/M2Quads.def: BuildConstructorStart,
BuildConstructorEnd, CollectConstructor, BuildComponentValue
added.
* gm2/gm2-compiler/M2Quads.mod: BuildConstructorStart,
BuildConstructorEnd, CollectConstructor, BuildComponentValue,
AddFieldTo implemented.
* gm2/gm2-compiler/P1SymBuild.mod: use
PutEnumerationIntoFifoQueue.
* gm2/gm2-compiler/P2SymBuild.mod: use
GetEnumerationFromFifoQueue and PutSubrangeInfoFifoQueue.
Implement constructor type checking and add error messages.
Implement constructor symbol creation.
* gm2/gm2-compiler/P3SymBuild.mod: use
GetSubrangeFromFifoQueue.
* gm2/gm2-compiler/SymbolTable.def: export IsConstructor
and PutConstructor.
* gm2/gm2-compiler/SymbolTable.mod: add IsConstructor
field to SymConstVar and SymConstLit record in symbol
table. Implement procedures IsConstructor and
PutConstructor.
* gm2/gm2-compiler/gccgm2.def: declare and export
new versions of BuildStartSetConstructor,
BuildSetConstructorElement, BuildEndSetConstructor.
Also export BuildStartRecordConstructor,
BuildEndRecordConstructor, BuildRecordConstructorElement,
BuildStartArrayConstructor, BuildEndArrayConstructor and
BuildArrayConstructorElement. Also export Constructor
hidden type.
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>