[Compiler-sig] Slices
Finn Bock
bckfnn@worldonline.dk
Thu, 18 Apr 2002 18:44:22 GMT
Hi,
Trying again for some feedback on the slice production. I still can't
figure out how to use the existing Slice and ExtSlice so I tried to make
some changes like this:
slice = Ellipsis | Slice(expr? lower, expr? upper)
-- maybe Slice and ExtSlice should be merged...
- | ExtSlice(expr* dims)
+ | ExtSlice(slice* dims)
+ | Index(expr value)
boolop = And | Or
Which I use in the following way (one the slice part of the Subscript is
included):
L[1]
slice=Index[value=Num[n=1]]
L[1:2]
slice=Slice[lower=Num[n=1], upper=Num[n=2]]
L[1:2, 3]
slice=ExtSlice[dims=[
Slice[lower=Num[n=1], upper=Num[n=2]],
Index[dims=Num[n=3]
]]
A single expr is wrapped by the Index(), a slice is ofcourse wrapped
with a Slice() and comma seperated list of slices is wrapped by a
ExtSlice() object.
Does it make sense?
regards,
finn