Abstract
Proper formatting makes the structure of a program apparent and aids program comprehension. The need to format code arises in code generation and transformation, as well as in normal reading and editing situations. Commonly used pretty-printing tools in transformation frameworks provide an easy way to produce indented code that is fairly readable for humans, without reaching the level of purpose-built reformatting tools, such as those built into IDEs. This paper presents a library of pluggable components, built to support style-based formatting and reformatting of code, and to enable further experimentation with code formatting.
Keywords
- Parse Tree
- Control Token
- Code Format
- Abstract Syntax Tree
- Java Library
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This is a preview of subscription content, access via your institution.
Buying options
Preview
Unable to display preview. Download preview PDF.
References
van den Brand, M.G.J., Visser, E.: Generation of formatters for context-free languages. ACM Transactions on Software Engineering and Methodology 5(1), 1–41 (1996)
Chitil, O.: Pretty printing with lazy dequeues. ACM Trans. Program. Lang. Syst. 27, 163–184 (2005)
Coutaz, J.: A layout abstraction for user-system interface. SIGCHI Bull. 16(3), 18–24 (1985), http://doi.acm.org/10.1145/1044201.1044202
Flatt, M.: PLT: Reference: Racket. Tech. Rep. PLT-TR-2010-1, PLT Inc (2010), http://racket-lang.org/tr1/
Hughes, J.: The design of a pretty-printing library. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 53–96. Springer, Heidelberg (1995)
Jackson, S., Devanbu, P., Ma, K.L.: Stable, flexible, peephole pretty-printing. Science of Computer Programming 72(1-2), 40–51 (2008)
James, R.P., Sabry, A.: Yield: Mainstream delimited continuations. In: First International Workshop on the Theory and Practice of Delimited Continuations, TPDC 2011 (May 2011)
de Jonge, M.: A pretty-printer for every occasion. In: Ferguson, I., Gray, J., Scott, L. (eds.) Proceedings of the 2nd International Symposium on Constructing Software Engineering Tools (CoSET 2000), University of Wollongong, Australia, pp. 68–77 (June 2000)
Kiselyov, O., Peyton-Jones, S., Sabry, A.: Lazy v. Yield: Incremental, linear pretty-printing. In: Jhala, R., Igarashi, A. (eds.) APLAS 2012. LNCS, vol. 7705, pp. 190–206. Springer, Heidelberg (2012)
Klint, P., van der Storm, T., Vinju, J.: Rascal: A domain specific language for source code analysis and manipulation. In: SCAM 2009: Proceedings of the 2009 Ninth IEEE International Working Conference on Source Code Analysis and Manipulation, pp. 168–177. IEEE Computer Society, Washington, DC (2009)
McKeeman, W.M.: Algorithm 268: Algol 60 reference language editor. Commun. ACM 8(11), 667–668 (1965)
Miara, R.J., Musselman, J.A., Navarro, J.A., Shneiderman, B.: Program indentation and comprehensibility. Commun. ACM 26(11), 861–867 (1983)
Okasaki, C.: Purely Functional Data Structures. Cambridge University Press (1999)
Oppen, D.C.: Prettyprinting. ACM Trans. Program. Lang. Syst. 2, 465–483 (1980)
Reiss, S.P.: Automatic code stylizing. In: 22nd IEEE/ACM International Conference on Automated Software Engineering (ASE), Atlanta, Georgia, pp. 74–83 (November 2007)
Swierstra, S.D.: Linear, online, functional pretty printing (corrected and extended version). Tech. Rep. UU-CS-2004-025a, Department of Information and Computing Sciences, Utrecht University (2004)
Swierstra, S.D., Chitil, O.: Linear, bounded, functional pretty-printing. Journal of Functional Programming 19(1), 1–16 (2009)
Wadler, P.: A prettier printer. In: Gibbons, J., de Moor, O. (eds.) The Fun of Programming. Cornerstones of Computing. Palgrave Macmillan (June 2005)
Wadler, P., Taha, W., Macqueen, D.: How to add laziness to a strict language without even being odd. In: Workshop on Standard ML, Baltimore, Maryland (1998)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer International Publishing Switzerland
About this paper
Cite this paper
Bagge, A.H., Hasu, T. (2013). A Pretty Good Formatting Pipeline. In: Erwig, M., Paige, R.F., Van Wyk, E. (eds) Software Language Engineering. SLE 2013. Lecture Notes in Computer Science, vol 8225. Springer, Cham. https://doi.org/10.1007/978-3-319-02654-1_10
Download citation
DOI: https://doi.org/10.1007/978-3-319-02654-1_10
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-02653-4
Online ISBN: 978-3-319-02654-1
eBook Packages: Computer ScienceComputer Science (R0)