possibile aggiungere commenti, sul serio
This commit is contained in:
parent
7b972fc406
commit
19b6c69237
@ -102,7 +102,6 @@ class VMAssembler:
|
||||
symcall = symcall_re.match(str(i))
|
||||
if symcall:
|
||||
symname = symcall.group(1)
|
||||
|
||||
# checking if it's a jump to a label
|
||||
if symname in [y.label for x in self.functions for y in x.instructions]:
|
||||
fun = next(
|
||||
@ -235,7 +234,6 @@ class VMAssembler:
|
||||
reg_op_re = re.compile(".*[rR]$")
|
||||
symcall = symcall_re.match(str(instruction))
|
||||
dst = instruction.args[0]
|
||||
print(instruction)
|
||||
# define the kind of jump: to immediate or to register
|
||||
if imm_op_re.match(instruction.opcode.name):
|
||||
self.immonly(instruction)
|
||||
@ -347,7 +345,6 @@ class VMInstruction:
|
||||
raise InvalidOperation(opcode)
|
||||
self.size = ops_sizes[self.opcode.method]
|
||||
args = [x for x in ins.groups()[1:] if x is not None]
|
||||
print("OP: {} | ARGS: {} | SYMCALL: {}".format(self.opcode, args,symcall))
|
||||
for a in args:
|
||||
if immediate_re.match(a) or symcall:
|
||||
# directly append the immediate
|
||||
@ -485,13 +482,13 @@ ops_sizes = {"reg2reg": 2,
|
||||
ops = [VMComponent(le[0], i, le[1]) for i, le in enumerate(op_names)]
|
||||
regs = [VMComponent(s.casefold(), i) for i, s in enumerate(reg_names)]
|
||||
instruction_re = re.compile(
|
||||
"^([\w]{4})(?:(?:\ *\#\ *[\w]*)|(?:\ +(?:([\w]+)\ *(?:,[\ ]*([\w]+))?)(?:\ *\#\ *[\w]*)?))?$") # 1: opcode 2+: args
|
||||
function_re = re.compile("(?:def\ )([a-zA-Z]*)\:")
|
||||
"^([\w]{4})(?:(?:\ *\#.*)|(?:\ +(?:([\w]+)\ *(?:,[\ ]*([\w]+))?)(?:\ *\#.*)?))?$") # 1: opcode 2+: args
|
||||
function_re = re.compile("(?:def\ )([a-zA-Z]*)\:(?:\ *\#.*)?$")
|
||||
immediate_re = re.compile("(?:0x)?[0-9a-fA-F]+$")
|
||||
alpha_re = re.compile("^[a-zA-Z]*$")
|
||||
register_re = re.compile("(^[rRsS][0-4]$)|([iIrRsS][pP]$)")
|
||||
label_re = re.compile("^([a-zA-Z]+)\:(?:\ *\#\ *[\w]*)?$")
|
||||
symcall_re = re.compile("^(?:[jJ][pPmM][pPaAbBeEnN][iIrR]|(?:[cC][aA][lL]{2}))(\ +[\w]+)(?:\ *\#\ *[\w]*)?$")
|
||||
label_re = re.compile("^([a-zA-Z]+)\:(?:\ *\#.*)?$")
|
||||
symcall_re = re.compile("^(?:[jJ][pPmM][pPaAbBeEnN][iIrR]|(?:[cC][aA][lL]{2}))\ +([\w]+)(?:\ *\#.*)?$")
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user