pixee/codemodder-java

Look around for DSLs on code transformations and refactorings

markusvoelter opened this issue · 2 comments

Look around for DSLs on code transformations and refactorings

Worth a second look

https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.482.3227&rep=rep1&type=pdf
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.94.859&rep=rep1&type=pdf
https://kar.kent.ac.uk/30807/1/wrt12.pdf
https://link.springer.com/content/pdf/10.1007/978-3-642-28872-2_34.pdf
http://www.cs.kent.edu/~jmaletic/papers/SANER17-srcQL.pdf
https://www.cs.usask.ca/faculty/kas/papers/TXLSE_IST.pdf
https://pdf.sciencedirectassets.com/271600/1-s2.0-S0167642306X01314/1-s2.0-S0167642306000669/main.pdf

Not immediately relevant

https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.158.9635&rep=rep1&type=pdf
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.679.6502&rep=rep1&type=pdf
https://www.researchgate.net/profile/Dave-Thomas-8/publication/220299576_Refactoring_as_Meta_Programming/links/56f148a208ae5c367d4a9f7f/Refactoring-as-Meta-Programming.pdf
https://www.cs.kent.edu/~jmaletic/cs63902/Papers/Klint-scam-09.pdf
https://onlinelibrary.wiley.com/doi/abs/10.1002/spe.704
https://www.cs.cornell.edu/andru/papers/padl03.pdf
https://pdf.sciencedirectassets.com/272990/1-s2.0-S1571066107X03153/1-s2.0-S1571066107005191/main.pdf?X-Amz-Security-Token=IQoJb3JpZ2luX2VjELr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQDyXTAsF%2Fe%2BmE7fFkXsvYeajQjVwHBRmvCCRY7HxsCV5AIgdJ4yiJeUAGOcMGurwgfAbDuPiAbicaNiJLYPUOlSkcgq0gQIEhAFGgwwNTkwMDM1NDY4NjUiDG7%2F9GrEVughUlAEUSqvBGtJ3hvRMF0RYqfmbFlhv3lCL62tzal6SVNSc312ihLpNGewRLq6K83CRNJkFl3npSuSEQvq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HK74%2F20220729%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=78f311c146acbec62392bd8d0727f82f94437c421fe102e6cd95f6b777fa66c3&hash=e1893d8e98c20ce906515f48618c6e7c784d2affb302be85688f30a3034f4ac6&host=68042c943591013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=S1571066107005191&tid=spdf-2b596e1b-3b93-4808-bc32-f43aebc7791f&sid=ed5933e65ba5b14de50acfd7b7bc33b35a8fgxrqb&type=client&ua=52545655050251040207&rr=7324fd3dde6fbb55
https://www.inf.usi.ch/faculty/nystrom/papers/padl08-matchete.pdf
https://www.sciencedirect.com/science/article/pii/S0167642306000669?ref=pdf_download&fr=RR-2&rr=73250a7b88069bd1
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.48.9125&rep=rep1&type=pdf

Lessons learned

Rumpe: ... Ich wollte noch erwähnen, dass mein Eindruck bei den
Programmtransformationen der ist, dass diese ja aus drei Teilen bestehen:

  1. Pattern Teil, um Stellen zu identifizieren

  2. Transformationteil (rechte Seite)
    da ist eine Mischung aus Pattern und imperativen Teil of sinnvoll

und
3) Anwendungsbedingungen.
Und die sind überhaupt nicht ohne: Teilweise hochkomplex,
wie etwa Seiteneffektfrei (auf bestimmte Werte),
Determiniertes Ergebnis
absturzsicher und erfordern bei Methodenufrufen ja eine
hochkomplexeAnalyselogik dahinter.

Das Zeug interessiert mich sehr stark (ich bin da CIP' angefixt :-),
seit meiner Studienzeit.

Generelle Prog Trafo Community is relevant

In addition/alternative to using the declarative approach, we can also use
a "regualar" scripting language that talks to an AST API. A bit like MPS
java-expressed transformations, or this stuff:
http://www.cs.ecu.edu/hillsma/presentations/hills-klint-vinju-2012-wrt-presentation.pdf

There is work that tries to use the concrete syntax of the target lang for matching.
https://www.researchgate.net/profile/Ian-Piumarta-2/publication/220828937_OMeta_An_object-oriented_language_for_pattern_matching/links/0a85e535837ec3d8b2000000/OMeta-An-object-oriented-language-for-pattern-matching.pdf
I see two problems. Makes building the DSL harder, and binds it to a particular
language - not independent of the subject lang.

Talk to Patrick Viry

International Workshop on Graph Based Tools

The hungarian Viatra folks

A pattern match might be ambiguous. Do we match the "shortest"? How do we express that?

The USF stuff (see attached paper) uses data flow and control flow as the main abstraction. This might be a better underlying data structure than the AST. But it requires the construction of a DFG for every program we want to analyze. Worth discussing, I think.