This Is AuburnElectronic Theses and Dissertations

Implementation of Fork-Merge Parsing in OpenRefactory/C




Krishnappa, Kavyashree

Type of Degree

Master's Thesis


Computer Science


C preprocessor directives are extensively used in C programs. Due to this, performing advanced program transformations on C programs is difficult. To obtain correct transformations, all possible configurations have to be considered. Modern IDEs ignore multiple configurations of the C preprocessor due to its complexity. OpenRefactory/C is an infrastructure that builds correct and complex transformations for C programs.The preprocessor and the program representation were modified to support multiple configurations in OpenRefactory/C. The C grammar was extended to include conditional directives in the program representation. The extended grammar allows conditional directives to appear in between certain complete C constructs. However, the conditional directives can appear in any part of the program. We modified the OpenRefactory/C parser to handle conditional directives that appear at an unexpected location in C programs and hence support multiple configurations.