arr = 300
arr[0] = "hi"
arr[1] = "there"
arr[2] = "my"
...
arr[298] = "very"
arr[299] = "tired"
Same question with a hash of hashes or whatever.
-Amir
Assigning an integer to the array should do the trick.
.local pmc arr
arr = new ResizablePMCArray
arr = 300
should allocate storage for at least 300 PMCs.
For Hashes I think there is no such allocation strategy.
CU, Bernhard
>
> Is there a way to declare an array of, say, 300 strings in PIR other
> than
>
> arr = 300
> arr[0] = "hi"
> arr[1] = "there"
> arr[2] = "my"
> ...
> arr[298] = "very"
> arr[299] = "tired"
Read the array entries from a text file?
> -Amir
leo
>
>
> On Aug 4, 2005, at 14:59, Amir Karger wrote:
>> Is there a way to declare an array of, say, 300 strings in PIR other
>> than
> Read the array entries from a text file?
The more, that it looks like that you are dealing with the string
abbreviation table, which is very likely Z version dependent.
>> -Amir
leo
Actually, I haven't gotten that far. I'm thinking of creating a hash of
hashes with information about each opcode (for each version, if I ever
get past z3). So, e.g., if I tell the interpreter which opcodes have
extra label arguments, then the generic translation routine will know
when to read the extra arg. I'm trying to refactor the code to remove
redundancies. But it seems like building the hash of hashes will take a
lot of tedious coding. I'm thinking I might take the list of opcodes
from the Z standard and Perlify it to a long list of Parrot commands to
create the hash of hashes. It sounds like there's no Perlish shortcut
like [[qw(a b c)], [qw(d e f)]] to do this sort of thing.
I have to keep reminding myself that PIR isn't a HLL. But I forget how
convenient syntactic sugar is.
-Amir