Graph-Based Algorithms for Boolean Function Manipulation
IEEE Transactions on Computers
A framework for preprocessor-aware C source code analyses
Software—Practice & Experience
Efficient Computation of LALR(1) Look-Ahead Sets
ACM Transactions on Programming Languages and Systems (TOPLAS)
Generalized L.R. Parsing
An Empirical Analysis of C Preprocessor Use
IEEE Transactions on Software Engineering
Derandomizing polynomial identity tests means proving circuit lower bounds
Proceedings of the thirty-fifth annual ACM symposium on Theory of computing
A static analyzer for large safety-critical software
PLDI '03 Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation
Properties of deterministic top down grammars
STOC '69 Proceedings of the first annual ACM symposium on Theory of computing
Preprocessor Conditional Removal by Simple Partial Evaluation
WCRE '01 Proceedings of the Eighth Working Conference on Reverse Engineering (WCRE'01)
WPC '97 Proceedings of the 5th International Workshop on Program Comprehension (WPC '97)
Refactoring Browser with Preprocessor
CSMR '03 Proceedings of the Seventh European Conference on Software Maintenance and Reengineering
Global Analysis and Transformations in Preprocessed Languages
IEEE Transactions on Software Engineering
Parsing expression grammars: a recognition-based syntactic foundation
Proceedings of the 31st ACM SIGPLAN-SIGACT symposium on Principles of programming languages
OOPSLA '04 Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
ASTEC: a new approach to refactoring C
Proceedings of the 10th European software engineering conference held jointly with 13th ACM SIGSOFT international symposium on Foundations of software engineering
Analyzing Multiple Configurations of a C Program
ICSM '05 Proceedings of the 21st IEEE International Conference on Software Maintenance
Reengineering C++ Component Models via Automatic Program Transformation
WCRE '05 Proceedings of the 12th Working Conference on Reverse Engineering
Better extensibility through modular syntax
Proceedings of the 2006 ACM SIGPLAN conference on Programming language design and implementation
Compilers: Principles, Techniques, and Tools (2nd Edition)
Compilers: Principles, Techniques, and Tools (2nd Edition)
Refactoring support for the C++ development tooling
Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companion
Can we refactor conditional compilation into aspects?
Proceedings of the 8th ACM international conference on Aspect-oriented software development
Parsing C/C++ Code without Pre-processing
CC '09 Proceedings of the 18th International Conference on Compiler Construction: Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009
A few billion lines of code later: using static analysis to find bugs in the real world
Communications of the ACM
Partial preprocessing C code for variability analysis
Proceedings of the 5th Workshop on Variability Modeling of Software-Intensive Systems
Proceedings of the sixth conference on Computer systems
LL(*): the foundation of the ANTLR parser generator
Proceedings of the 32nd ACM SIGPLAN conference on Programming language design and implementation
Variability-aware parsing in the presence of lexical macros and conditional compilation
Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
Configuration coverage in the analysis of large-scale system software
ACM SIGOPS Operating Systems Review
Feature-oriented software evolution
Proceedings of the Seventh International Workshop on Variability Modelling of Software-intensive Systems
Investigating preprocessor-based syntax errors
Proceedings of the 12th international conference on Generative programming: concepts & experiences
Extending Type Inference to Variational Programs
ACM Transactions on Programming Languages and Systems (TOPLAS)
OpenRefactory/C: an infrastructure for building correct and complex C transformations
Proceedings of the 2013 ACM workshop on Workshop on refactoring tools
Hi-index | 0.00 |
C tools, such as source browsers, bug finders, and automated refactorings, need to process two languages: C itself and the preprocessor. The latter improves expressivity through file includes, macros, and static conditionals. But it operates only on tokens, making it hard to even parse both languages. This paper presents a complete, performant solution to this problem. First, a configuration-preserving preprocessor resolves includes and macros yet leaves static conditionals intact, thus preserving a program's variability. To ensure completeness, we analyze all interactions between preprocessor features and identify techniques for correctly handling them. Second, a configuration-preserving parser generates a well-formed AST with static choice nodes for conditionals. It forks new subparsers when encountering static conditionals and merges them again after the conditionals. To ensure performance, we present a simple algorithm for table-driven Fork-Merge LR parsing and four novel optimizations. We demonstrate the effectiveness of our approach on the x86 Linux kernel.