MIT IEEE URTC 2024. GSET 2024. Repository for the "MBASED: Practical Simplifications of Mixed Boolean-Arithmetic Obfuscation". A Binary Ninja decompiler plugin taking ideas from compiler construction to simplify obfuscated boolean expressions.
After #10 is complete, we need to have a way to easily traverse the AST we just defined. While there are a few potential ways to implement this (see the CS 132 notes below for some motivation for using the visitor design pattern), the style that best follows software engineering practices is to use the visitor design pattern. The goal of this component is to write a baseline visitor which does nothing except traverse all of the nodes of the AST. This is meant to provide a base class for several other classes to implement which provides a good style to traverse all of the nodes of the AST and perform some operations.
Action Items
Do all of the following inside parser/visitor.py.
[ ] write a class called Visitor which has no constructor and implements a visit<node_name> function for every node type of the AST.
[ ] modifying the parser/ast.py file so that each node class has an accept function which will be called by the visitor. As well as an acceptRet function which calls a visitor function that returns.
[ ] write a test case to ensure the correctness of the visitor implementation. The test case could be something inheriting from the visitor and counting the number of nodes within the AST. Make sure to do this in the test/ directory.
References
Visitor Design Pattern. A great website which explains design patterns. This page contains an explanation of the visitor design pattern in addition to some code examples of how to implement it.
CS 132 Notes. Chapter 5 contains some notes motivating the reason for using the visitor pattern as opposed to other methods such as using instanceof. There is some additional content on parser generators for Java which can be skipped over.
After #10 is complete, we need to have a way to easily traverse the AST we just defined. While there are a few potential ways to implement this (see the CS 132 notes below for some motivation for using the visitor design pattern), the style that best follows software engineering practices is to use the visitor design pattern. The goal of this component is to write a baseline visitor which does nothing except traverse all of the nodes of the AST. This is meant to provide a base class for several other classes to implement which provides a good style to traverse all of the nodes of the AST and perform some operations.
Action Items
Do all of the following inside
parser/visitor.py
.Visitor
which has no constructor and implements avisit<node_name>
function for every node type of the AST.parser/ast.py
file so that each node class has anaccept
function which will be called by the visitor. As well as anacceptRet
function which calls a visitor function that returns.test/
directory.References
instanceof
. There is some additional content on parser generators for Java which can be skipped over.