Skip to content

Conversation

ziqingluo-90
Copy link

@ziqingluo-90 ziqingluo-90 commented Aug 8, 2025

The basic idea is to create a wrapper class that owns a container holding AST nodes. With that, substitution can be done by manipulating the container. This implementation uses a list to hold sequentialized Exprs.

With extra handling of DREs representing MemExprs, the implementation guarantees that if two expressions are equivalent, their sequentialized representation will have the same number of elements. Then the comparison can be done element-wise.

Examples of sequentialized expressions:

  1. x + y -> | + | x | y |, where + denotes a binary plus operation
  2. x[4].f -> | .f | [] | x | 4 | , where .f denotes a member field access; [] denotes array subscript;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant