Jump to Content

A New Approach to Optimal Code Formatting

Phillip Yelland
Google, Inc. (2016)


The rfmt code formatter incorporates a new algorithm that optimizes code layout with respect to an intuitive notion of layout cost. This note describes the foundations of the algorithm, and the programming abstractions used to facilitate its use with a variety of languages and code layout policies.