COMPILER FRONT END FUSION: UNDO DESUGARING IN LANGUAGE PROCESSING TOOLS

Authors

DOI:

https://doi.org/10.24193/subbi.2018.2.01

Keywords:

parser, abstract syntax tree, compiler front end, syntactic sugar, desugaring, refactoring.

Abstract

Compiler front ends often perform desugaring on the source code while constructing the abstract syntax tree (AST). A programming language processing tool (such as a refactoring tool) working with the desugared AST perceives the code at this abstract level, and loses information on the rich syntax used in the actual source code. This paper discusses the concept of front end fusion, a technique which may help language processing tools to retain the syntactic sugar information on the source code in the presence of desugaring compiler front ends. We propose a hybrid front end created from two separate front ends: one provided by the compiler, which offers type information, and another one, which provides the details of the concrete syntax used in the source code. Specifically, we show how to construct a hybrid front end in a language processing tool for the Scala programming language.

Author Biographies

Artúr POÓR, Eötvös Loránd University, Budapest, Hungary. Email: poor_a@inf.elte.hu

Eötvös Loránd University, Budapest, Hungary. Email: poor_a@inf.elte.hu

Tamás KOZSIK, Eötvös Loránd University, Budapest, Hungary. Email: kto@inf.elte.hu

Eötvös Loránd University, Budapest, Hungary. Email: kto@inf.elte.hu

Melinda TÓTH, Eötvös Loránd University, Budapest, Hungary. Email: tothmelinda@caesar.elte.hu toth_m@inf.elte.hu

Eötvös Loránd University, Budapest, Hungary. Email: tothmelinda@caesar.elte.hu toth_m@inf.elte.hu

István BOZÓ, Eötvös Loránd University, Budapest, Hungary. Email: bozoistvan@caesar.elte.hu bozo_i@inf.elte.hu

Eötvös Loránd University, Budapest, Hungary. Email: bozoistvan@caesar.elte.hu bozo_i@inf.elte.hu

References

Ericsson AB. Erlang Syntax Tools User’s Guide. http://erlang.org/doc/apps/syntax_tools/users_guide.html, 2018.

Alejandra Garrido. Program Refactoring in the Presence of Preprocessor Directives. PhD thesis, University of Illinois at Urbana-Champaign, Champaign, IL, USA, 2005. AAI3199001.

Adam Gundry. A Typechecker Plugin for Units of Measure. SIGPLAN Not., 50:11–22, August 2015.

Haskell-tools Refact. A GHC based toolset for Haskell programming. http://haskelltools.org, 2018.

Zoltán Horváth, László Lövei, Tamás Kozsik, Róbert Kitlei, Melinda Tóth, István Bozó, and Roland Király. Modeling semantic knowledge in erlang for refactoring. In Knowledge Engineering: Principles and Techniques, Proceedings of the International Conference on Knowledge Engineering, Principles and Techniques, KEPT, Sp. Issue, Studia Universitatis Babeş-Bolyai, Series Informatica, volume 54, pages 7–16, 2009.

Róbert Kitlei, I. Bozó, Tamás Kozsik, Máté Tejfel, and Melinda Tóth. Analysis of preprocessor constructs in erlang. In Proceedings of the 9th ACM SIGPLAN Erlang Workshop, pages 45–55, Baltimore, USA, September 2010.

Róbert Kitlei, László Lövei, Tamás Nagy, Zoltán Horváth, and Tamás Kozsik. Layout preserving parser for refactoring in Erlang. Acta Electrotechnica et Informatica, 9(3):54–63, 2009.

Donald E. Knuth. Literate programming. The Computer Journal, 27(2):97–111, 1984.

Huiqing Li and Simon Thompson. Tool support for refactoring functional programs. In Partial Evaluation and Program Manipulation, San Francisco, California, USA, January 2008. Assoc of Computing Machinery.

Bruno Cardoso Lopes and Rafael Auler. Getting Started with LLVM Core Libraries. Packt Publishing, 1st edition, 2014.

Simon Marlow and Simon Peyton-Jones. The glasgow haskell compiler, 2012. in The Architecture of Open Source Applications (Volume II: Structure, Scale, and a Few More Fearless Hacks ), http://aosabook.org/en/ghc.html.

Artúr Poór and Tamás Kozsik. Resugaring: Undo desugaring in language processing tools. Thessaloniki, Greece, 2017. To appear in the Proceedings of the Symphosium of Computer Languages and Tools.

Scalameta. Metaprogramming library for Scala. http://scalameta.org, 2018.

Dean Wampler and Alex Payne. Programming Scala – Scalability = Functional Programming + Objects. O’Reilly Media, 2nd edition, December 2014.

Downloads

Published

2018-12-28

How to Cite

POÓR, A., KOZSIK, T., TÓTH, M., & BOZÓ, I. (2018). COMPILER FRONT END FUSION: UNDO DESUGARING IN LANGUAGE PROCESSING TOOLS. Studia Universitatis Babeș-Bolyai Informatica, 63(2), 5–20. https://doi.org/10.24193/subbi.2018.2.01

Issue

Section

Articles