Skip to content

Instantly share code, notes, and snippets.

@arunk-s
Last active August 29, 2015 14:17
Show Gist options
  • Save arunk-s/f799d1d93788d1069b2c to your computer and use it in GitHub Desktop.
Save arunk-s/f799d1d93788d1069b2c to your computer and use it in GitHub Desktop.
Simple tavor format to generate assembly code statement
START = line |
register_name = "eax" | "ebx" | "ecx" | "edx"
label = +([\w]) ":"
inst_mov = "mov " register_name "," register_name,
| "mov " register_name "," +([\d])
inst_add = "add " register_name "," register_name,
| "add " register_name "," +([\d])
inst_jmp = "jmp " +([\w])
inst_inc = "inc " register_name
inst = inst_mov | inst_add | inst_inc | inst_jmp
line = inst | label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment