cakeml icon indicating copy to clipboard operation
cakeml copied to clipboard

Add word shifts to basis

Open SOwens opened this issue 8 years ago • 3 comments

Currently, the basis library doesn't include any shift operations in the Word8 or Word64 modules, and the parser can't generate Opapps with a Shift operation. Thus, the user cannot write programs that shift words in the surface syntax.

Ideally, we'd like to add >> and << as 2 argument CakeML functions, but the Shift op is a unary op with the amount to shift built into the operator. We either need to make Shift a binary op, or we have to add a restricted form of shifting where >> is defined in the basis as a function of two arguments that does a case split on the 2nd to pick out which Shift to actually do.

SOwens avatar May 03 '17 15:05 SOwens

By the way, the bootstrap translation currently uses these custom rewrites (that were recently moved into miscTheory):

https://github.com/CakeML/cakeml/blob/master/miscScript.sml#L2568

So these should translate fine for the basis if we are going for that route.

tanyongkiam avatar May 04 '17 04:05 tanyongkiam

Maybe this interacts with #171

xrchz avatar Nov 18 '17 08:11 xrchz

Related to #246 (we should just have variable length shifts throughout the compiler)

tanyongkiam avatar Nov 12 '24 13:11 tanyongkiam