A Core Calculus for Type-safe Product Lines of C Programs

šŸ“… 2026-03-04
šŸ“ˆ Citations: 0
✨ Influential: 0
šŸ“„ PDF
šŸ¤– AI Summary
This work addresses the lack of type safety in C’s preprocessor when generating program variants, which can yield ill-typed derivatives. To remedy this, the authors propose a lightweight core calculus for C (LC) and extend it with ANSI C preprocessor directives to form Colored LC (CLC). Building on this foundation, they design the first static type system for a C subset featuring preprocessor constructs, formally guaranteeing that all programs generated within a software product line are type-safe. This contribution provides a theoretically rigorous and pedagogically accessible formal basis for ensuring type safety in C-based software product lines.

Technology Category

Application Category

šŸ“ Abstract
In this paper we: (1) propose Lightweight C (LC), namely a core calculus that formalizes a proper subset of the ANSI C without preprocessor directives; (2) define Colored LC (CLC), namely LC endowed with ANSI C preprocessor directives; and (3) define a type system for CLC that guarantees that all programs to be generated by the C preprocessor are well-typed C programs. We believe that the simple formalization provided by CLC could be useful also for teaching purposes. Stefano Berardi spent most of his academic career at the Department of Computer Science of the University of Turin, where he conducts outstanding research on the logical foundations of computer science and on type-based program analyses. Over the years, he taught many courses, from BSc courses on programming with C to PhD courses on program analysis. Therefore, this paper fully falls within Stefano Berardi's research and teaching activities.
Problem

Research questions and friction points this paper is trying to address.

type safety
product lines
C preprocessor
formal calculus
program generation
Innovation

Methods, ideas, or system contributions that make the work stand out.

Core Calculus
Type Safety
C Preprocessor
Product Lines
Formal Semantics
šŸ”Ž Similar Papers
No similar papers found.