TY - GEN
T1 - SuperC
T2 - 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'12
AU - Gazzillo, Paul
AU - Grimm, Robert
PY - 2012
Y1 - 2012
N2 - 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 wellformed 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.
AB - 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 wellformed 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.
KW - C
KW - Fork-merge LR parsing
KW - LR parsing
KW - Preprocessor
KW - SuperC
UR - http://www.scopus.com/inward/record.url?scp=84863470851&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84863470851&partnerID=8YFLogxK
U2 - 10.1145/2254064.2254103
DO - 10.1145/2254064.2254103
M3 - Conference contribution
AN - SCOPUS:84863470851
SN - 9781450312059
T3 - Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)
SP - 323
EP - 334
BT - PLDI'12 - Proceedings of the 2012 ACM SIGPLAN Conference on Programming Language Design and Implementation
Y2 - 11 June 2012 through 16 June 2012
ER -