Adapted from 64-bit reverse polish JIT compiler

The call to execute the compiled expression is unimplemented as my personal edition of kdb+ is 32bit and don’t want to write the 32bit to long mode and back again hack.

$ q r.q KDB+ 3.4 2016.06.14 Copyright (C) 1993-2016 Kx Systems 0x4889e548b8ffffffffffffff7f48b80100000000000000585b4801d8504889ecc3

64bit RPN compiler in q and kdb+ /save rsp, push literals, if op, pop twice and addq, subq.. and push c:{raze 0x4889e5,(d each x),0x4889ec,0xc3} d:{$[102-type x;0x48b8,x;0x58,0x5b,((0x4801d8;0x4829d8;0x480fafc3;0x4899,0x4889ec)(+;-;*;%)?x),0x50]} j:-8#-8!7h$ t:{@[x;;j]where 0<>102 -7h?(type')x:(value'){x where not (1#" ")~/:x}@-4!x} c t"9223372036854775807 1 +" 1 2 3 4 5 6 / save rsp , push literals , if op , pop twice and addq , subq . . and push c : { raze 0x4889e5 , ( d each x ) , 0x4889ec , 0xc3 } d : { $ [ 102 - type x ; 0x48b8 , x ; 0x58 , 0x5b , ( ( 0x4801d8 ; 0x4829d8 ; 0x480fafc3 ; 0x4899 , 0x4889ec ) ( + ; - ; * ; % ) ? x ) , 0x50 ] } j : - 8 #-8!7h$ t : { @ [ x ; ; j ] where 0 <> 102 - 7h ? ( type ')x:(value' ) { x where not ( 1 #" ")~/:x}@-4!x} c t "9223372036854775807 1 +"