Related articles |
---|
Arrays in P.L to 68K compilation nursingh@clyde.ens.insa-rennes.fr (1995-06-03) |
Newsgroups: | comp.compilers |
From: | nursingh@clyde.ens.insa-rennes.fr |
Keywords: | code, design, question |
Organization: | UTexas Mail-to-News Gateway |
Date: | Sat, 3 Jun 1995 10:51:39 GMT |
Status: | RO |
Help!
I'm writing a pseudo-language to 68K-code compiler and I need to
implement arrays in the following way:
Please send any help to my email @ : nursingh@clyde.ens.insa-rennes.fr
1. On the grammar side:
I have a type identifier :
type array[1..10] of integer = aint;
array[0..80] of character = achar;
array[0..6] of aint = a_of_aint;
so this gives me arrays of arrays because as soon as a type is
defined, its name can be used in a subsequent definition.
These types can also be used in local and global variable
declaration:
var aint : a1,a2;
a_of_aint : aa1,aa2;
2. On the instruction side:
these should be possible :
(a) a1 := a2;
Should this be a pointer redirection or a complete copy of the
array, element by element ?
(b) aa1[1] := a1;
(c) a1[i] := 5;
(d) aa1[i][j] := 0;
It should be possible to use an array element as an expression
operand ,provided the type is compatible with the operator.
An array element acn be used as a parameter for a procedure:
sum_of_positions(aa1[i])(a2[j]);
^ ^
fixed equivalent to Pascal "var"
swap()(a1[i],aa1[j][i]);
where swap is : procedure swap modifiables(integer :x,y);
I need to know how to manage array-type variables and parameters at
execute time. Plus, when to calculate element adresses and verify the array
indices.
Any help about how to fill the symbol table and 68k code
would be most welcome.
Yash.
nursingh@clyde.ens.insa-rennes.fr
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.