Ejemplo n.º 1
0
def KNamedList(klabel, empty_klabel, items):
    tail = KApply(empty_klabel, [])
    while not items == []:
        last = items.pop()
        tail = KApply(klabel, [last, tail])
    return tail
Ejemplo n.º 2
0
def I64_STORE8(offset: int):
    return KApply('aStore', [i64, KApply('storeOpStore8', []), KInt(offset)])
Ejemplo n.º 3
0
def I64_STORE32(offset: int):
    return KApply('aStore', [i32, KApply('storeOpStore32', []), KInt(offset)])
Ejemplo n.º 4
0
def I32_CONST(i: int):
    return (KApply('aIConst', [i32, KInt(i)]))
Ejemplo n.º 5
0
def F32_STORE(offset: int):
    return KApply('aStore', [f32, KApply('storeOpStore', []), KInt(offset)])
Ejemplo n.º 6
0
def CALL(function_idx: int):
    return KApply('aCall', [KInt(function_idx)])
Ejemplo n.º 7
0
def F32_CONST(f: float):
    return KApply('aFConst', [f32, KFloat(f)])
Ejemplo n.º 8
0

def val_types(items):
    return KNamedList(VAL_TYPES, VAL_TYPES_NIL, items)


def ints(iis: [int]):
    kis = [KInt(x) for x in iis]
    return KNamedList(INTS, INTS_NIL, kis)


###########
# Empties #
###########

EMPTY_ID = KApply(EMPTY_ID, [])

EMPTY_DEFNS = KApply(EMPTY_STMTS, [])

EMPTY_MODULE_METADATA = KApply(MODULE_METADATA,
                               [EMPTY_ID, KApply(EMPTY_MAP, [])])

EMPTY_FUNC_METADATA = KApply(FUNC_METADATA, [EMPTY_ID, KApply(EMPTY_MAP, [])])

#########
# Types #
#########

i32 = KApply('i32', [])
i64 = KApply('i64', [])
f32 = KApply('f32', [])
Ejemplo n.º 9
0
def vec_type(valtypes):
    return KApply(VEC_TYPE, [valtypes])
def get_steps_validator_reward(step):
    tx = mandos_to_validator_reward_tx(step['tx'])
    return [KApply('validatorReward', [tx])]
 def KList_aux(lis):
     if lis == []:
         return KApply(".List", [])
     head = lis[0]
     tail = KList_aux(lis[1:])
     return KApply("_List_", [head, tail])
def get_steps_transfer(step):
    tx = mandos_to_transfer_tx(step['tx'])
    return [KApply('transfer', [tx])]
def register(with_name: str):
    return KApply('register', [KString(with_name)])
def mandos_to_validator_reward_tx(tx):
    to = mandos_argument_to_kbytes(tx['to'])
    value = mandos_int_to_kint(tx['value'])

    rewardTx = KApply('validatorRewardTx', [to, value])
    return rewardTx
Ejemplo n.º 15
0
def BR_IF(idx: int):
    return KApply('aBr_if', [KInt(idx)])
Ejemplo n.º 16
0
def func_type(params, results):
    return KApply(FUNC_TYPE, [params, results])
Ejemplo n.º 17
0
def BR_TABLE(idxs: [int], default):
    return KApply('aBr_table', [ints(idxs + (default, ))])
Ejemplo n.º 18
0
def limits(tup):
    i = tup[0]
    j = tup[1]
    if j is None:
        return KApply('limitsMin', [KInt(i)])
    return KApply('limitsMinMax', [KInt(i), KInt(j)])
Ejemplo n.º 19
0
def CALL_INDIRECT(type_idx: int):
    return KApply('aCall_indirect', [KInt(type_idx)])
Ejemplo n.º 20
0
def global_type(mut, valtype):
    return KApply(GLOBAL_TYPE, [mut, valtype])
Ejemplo n.º 21
0
def F64_CONST(f: float):
    return KApply('aFConst', [f64, KFloat(f)])
Ejemplo n.º 22
0
def BLOCK(vec_type, instrs):
    return KApply('aBlock', [vec_type, instrs])
Ejemplo n.º 23
0
def I64_CONST(i: int):
    return (KApply('aIConst', [i64, KInt(i)]))
Ejemplo n.º 24
0
def IF(vec_type, then_instrs, else_instrs):
    return KApply('aIf', [vec_type, then_instrs, else_instrs])
Ejemplo n.º 25
0
def F64_STORE(offset: int):
    return KApply('aStore', [f64, KApply('storeOpStore', []), KInt(offset)])
Ejemplo n.º 26
0
def LOOP(vec_type, instrs):
    return KApply('aLoop', [vec_type, instrs])
Ejemplo n.º 27
0
def I32_STORE16(offset: int):
    return KApply('aStore', [i32, KApply('storeOpStore16', []), KInt(offset)])
Ejemplo n.º 28
0
def BR(idx: int):
    return KApply('aBr', [KInt(idx)])
Ejemplo n.º 29
0
def F32_LOAD(offset: int):
    return KApply('aLoad', [f32, KApply('loadOpLoad', []), KInt(offset)])
Ejemplo n.º 30
0
def module_metadata(mid=None, fids=None, filename=None):
    # TODO: Implement module id and function ids metadata transformation.
    kfilename = EMPTY_OPT_STRING if filename is None else KString(filename)
    return KApply(MODULE_METADATA, [EMPTY_ID, EMPTY_MAP, kfilename])