I would like to scan all project files in a python project, identify all instantiations of objects that are subclass of a certain type and then: 1. Add the "yield" keyword to the object instantiation 2. identify all call stack for that object creation, and add a decorator to all functions in that call stack.
is that doable using Rascal?
When you have a representation of your Python source code as tree (parse tree or abstract syntax tree) you can convert this to a Rascal data type and use Rascal for further processing. This can be achieved by using and connecting an existing Python parser to generate the Rascal representation of your Python program. This could be done by simply dumping the parse tree in a format that can be read by Rascal.
Why this complex solution: because the built-in parser generator of Rascal is not (yet) well equipped to parse indentation-sensitive languages like Python.
Check out the python-air front-end for Rascal: https://www.rascal-mpl.org/docs/Packages/PythonAir/