[Paper Review] Translating Xd-C programs to MSVL programs
This paper presents a translation framework that automatically converts Xd-C programs— a restricted, semantically complete subset of C—into equivalent MSVL programs for runtime verification using the UMC4M tool. The approach uses formal operational semantics to prove semantic equivalence between Xd-C and MSVL constructs, and implements the method in a tool called C2M, which successfully translates 13 real-world C programs with linear time complexity and maintains strong behavioral equivalence.
C language is one of the most popular languages for software systems. In order to verify safety, reliability and security properties of such systems written in C, a tool UMC4M for runtime verification at code level based on Modeling, Simulation and Verification Language (MSVL) and its compiler MC is employed. To do so, a C program $P$ has to be translated to an MSVL program M and the negation of a desired property $Q$ is also translated to an MSVL program M', then "M and M" is compiled and executed armed with MC. Whether $P$ violates $Q$ is checked by evaluating whether there exists an acceptable execution of new MSVL program M and M". Therefore, how to translate a C program to an MSVL program is a critical issue. However, in general, C is of complicated structures with goto statement. In this paper, we confine the syntax of C in a suitable subset called Xd-C without loss of expressiveness. Further, we present a translation algorithm from an Xd-C program to an MSVL program based on translation algorithms for expressions and statements. Moreover, the equivalences between expressions and statements involved in Xd-C and MSVL programs are inductively proved. Subsequently, the equivalence between the original Xd-C program and the translated MSVL program is also proved. In addition, the proposed approach has been implemented by a tool called $C2M$. A benchmark of experiments including 13 real-world Xd-C programs is conducted. The results show that $C2M$ works effectively.
Motivation & Objective
- To enable formal verification of C programs at the code level using runtime verification via MSVL.
- To address the challenge of translating complex C programs with goto statements into a formal verification-friendly language.
- To define a restricted but expressive subset of C (Xd-C) that preserves essential semantics while enabling reliable translation to MSVL.
- To formally prove the semantic equivalence between Xd-C programs and their MSVL translations using operational semantics.
- To implement and evaluate a practical tool (C2M) for automated translation of real-world C programs to MSVL for verification.
Proposed method
- Define Xd-C as a restricted subset of C that excludes goto statements but retains all essential data types and control structures.
- Design a translation algorithm mapping Xd-C declarations, expressions, and statements to equivalent MSVL constructs using syntactic and semantic rules.
- Formalize operational semantics for both Xd-C and MSVL using big-step semantics to capture termination and divergence.
- Prove statement and expression equivalence via structural and rule induction based on the operational semantics.
- Implement the translation pipeline in a tool called C2M, including preprocessing, lexical and syntactic analysis using a Parser Generator (PG), and MSVL code generation.
- Optimize the output using post-processing and integrate with custom libraries for Xd-C and MSVL functions to support real-world program translation.
Experimental results
Research questions
- RQ1Can a restricted subset of C (Xd-C) be defined such that it retains the expressiveness needed for system-level programming while enabling correct translation to MSVL?
- RQ2How can a formal translation algorithm be designed to preserve semantic equivalence between Xd-C and MSVL programs?
- RQ3What is the time complexity of the translation process, and can it scale to real-world programs?
- RQ4To what extent does the C2M tool maintain behavioral equivalence between original C programs and their MSVL counterparts?
- RQ5Can the translated MSVL programs be effectively verified using the UMC4M tool and its MSVL compiler MC?
Key findings
- The C2M tool successfully translates 13 real-world Xd-C programs, including benchmarks from RERS and SPEC2000, into equivalent MSVL programs.
- The average size of the generated MSVL programs is approximately 2.6 times that of the original Xd-C programs, with a linear time complexity of O(n), where n is the number of statements.
- Translation time for the largest program (twolf, ~17k LOC) was 7.11 seconds, and the total time for all 13 programs was 95.15 seconds.
- The formal proof establishes semantic equivalence between Xd-C and MSVL programs through inductive reasoning on expressions and statements.
- The tool maintains strong behavioral correspondence, enabling accurate runtime verification via UMC4M without false positives or negatives from model abstraction.
- The benchmark results confirm that C2M is effective and scalable for industrial-scale C programs, supporting future integration into full verification pipelines.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.