summaryrefslogtreecommitdiff
path: root/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2024-03-05 19:50:13 -0500
committerRusty Wagner <rusty.wagner@gmail.com>2024-03-05 20:34:34 -0500
commite093c21ed880ac3eb72119be15093ee04f8ce299 (patch)
tree9f720ebdc0ae415734b1199ed341668c69710a94 /arch/armv7/thumb2_disasm/arm_pcode_parser/README.md
parent0609276712622908254065546102381466033141 (diff)
Move architecture modules into the API repo
Diffstat (limited to 'arch/armv7/thumb2_disasm/arm_pcode_parser/README.md')
-rw-r--r--arch/armv7/thumb2_disasm/arm_pcode_parser/README.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md b/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md
new file mode 100644
index 00000000..c3adae56
--- /dev/null
+++ b/arch/armv7/thumb2_disasm/arm_pcode_parser/README.md
@@ -0,0 +1,75 @@
+# goal
+translate the pseudocode for arm instructions (given in the docs) to target languages
+
+once the pcode is extracted, automatic generation of ultra-accurate disassemblers should become possible
+
+# how
+use Grako parser generator, describe the language (pcode.ebnf) and write code generator (codegen.py)
+
+# example
+input statement:
+```
+if n == 15 || BitCount(registers) < 2 || (P == '1' && M == '1') then UNPREDICTABLE
+```
+
+output parse tree:
+```
+[
+ "if",
+ [
+ "n",
+ [],
+ [
+ "==",
+ [
+ "15",
+ []
+ ],
+ "||",
+ [
+ "BitCount(",
+ [
+ "registers",
+ []
+ ],
+ ")"
+ ],
+ "<",
+ [
+ "2",
+ []
+ ],
+ "||",
+ [
+ "(",
+ "P",
+ [],
+ [
+ "==",
+ [
+ "'1'",
+ []
+ ],
+ "&&",
+ [
+ "M",
+ []
+ ],
+ "==",
+ [
+ "'1'",
+ []
+ ]
+ ],
+ [],
+ ")"
+ ]
+ ]
+ ],
+ "then",
+ "UNPREDICTABLE"
+]
+```
+
+
+