Code2LowCode: An Interactive Tool for Lifting Code Clones into Reusable Abstractions
Abstract
Code duplication is widespread in software, yet the dominant response, clone detection, stops at flagging duplication and leaves the harder, value-creating step to developers: turning recurring code into reusable abstractions. We argue that recent advances in Large Language Models (LLMs), combined with classical clone analysis and the rich abstraction vocabulary of Model-Driven Engineering (MDE), make it possible to begin closing this gap automatically. We present Code2LowCode, a prototype that connects clone detection to MDE by lifting detected clones into reusable, validated artifacts. Code2LowCode combines two ideas. First, a cascaded hybrid detection pipeline routes candidate clone pairs through increasingly expensive tiers, from classical detectors to code embeddings to LLM classifiers. This ensures that cheap tiers resolve clear cases (Types 1-3), while only ambiguous, potentially semantic (Type 4) pairs reach costly analysis. Second, an LLM-driven, human-in-the-loop workspace analyzes the resulting clone set and proposes a unified abstraction strategy, emitting concrete MDE artifacts, such as parameterized templates, ANTLR4 DSL grammars, EMF Ecore metamodels, and JSON schemas. Each artifact is validated (grammar compilation, javac, schema checks) and approved by a developer before target code is generated in an agentic workflow. This reframes clone management not as defect-hunting but as a path toward automated low-code asset creation.