Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
From the corresponding docstring:
Then, one can iterate over solutions using
Restrictions can be applied on jokers, for instance:
In the previous example, if one wants to only catch basic blocks starting with a
j1 = MatchGraphJoker(restrict_in=False, filt=lambda block: len(block.lines) and block.line.name == "PUSH")
The algorithm uses for pattern matching is naive, but oriented to quickly provides solutions. In others word, it may have a lot of work between two yielded solutions but a first solution should appear quickly (as the difference between a Depth-first search and a Breadth-first search).
In reasonable graph size, as program functions CFG, the algorithm is fast enough to be usable.