St. Petersburg Polytechnical University Journal. Computer Science. Telecommunication and Control Systems
RUS  ENG    JOURNALS   PEOPLE   ORGANISATIONS   CONFERENCES   SEMINARS   VIDEO LIBRARY   PACKAGE AMSBIB  
General information
Latest issue
Archive

Search papers
Search references

RSS
Latest issue
Current issues
Archive issues
What is RSS



Computing, Telecommunication and Control:
Year:
Volume:
Issue:
Page:
Find






Personal entry:
Login:
Password:
Save password
Enter
Forgotten password?
Register


St. Petersburg Polytechnical University Journal. Computer Science. Telecommunication and Control Systems, 2015, Issue 4(224), Pages 37–50
DOI: https://doi.org/10.5862/JCSTCS.224.4
(Mi ntitu114)
 

Software of Computer, Telecommunications and Control Systems

A language-independent code formatting by syntactic matching and templates

A. V. Podkopaev, A. Yu. Korovianskii, I. S. Ozernykh

Saint Petersburg State University
Abstract: In paper we consider a code-formatting problem. A novel concept of declarative printers is introduced. These devices can perform formatting in accordance with the style of the rest of the source code. For this purpose, declarative formatters extract syntactic templates from the sample code and use them to construct a new representation of the input program. A proposed solution produces optimal program presentation in polynomial time. It is achieved by using polynomial-time pretty-printer combinators and introducing a partial order on text representations. We also present the results of evaluating the approach in the Java and Haskell languages. The development of a declarative printer for simple imperative language While is described. A comparison with modern IDEs code formatters is also presented.
Keywords: formatting, template, combinators.
Document Type: Article
UDC: 004.4'232
Language: Russian
Citation: A. V. Podkopaev, A. Yu. Korovianskii, I. S. Ozernykh, “A language-independent code formatting by syntactic matching and templates”, St. Petersburg Polytechnical University Journal. Computer Science. Telecommunication and Control Sys, 2015, no. 4(224), 37–50
Citation in format AMSBIB
\Bibitem{PodKorOze15}
\by A.~V.~Podkopaev, A.~Yu.~Korovianskii, I.~S.~Ozernykh
\paper A language-independent code formatting by syntactic matching and templates
\jour St. Petersburg Polytechnical University Journal. Computer Science. Telecommunication and Control Sys
\yr 2015
\issue 4(224)
\pages 37--50
\mathnet{http://mi.mathnet.ru/ntitu114}
\crossref{https://doi.org/10.5862/JCSTCS.224.4}
Linking options:
  • https://www.mathnet.ru/eng/ntitu114
  • https://www.mathnet.ru/eng/ntitu/y2015/i4/p37
  • Citing articles in Google Scholar: Russian citations, English citations
    Related articles in Google Scholar: Russian articles, English articles
    Computing, Telecommunication and Control
    Statistics & downloads:
    Abstract page:124
    Full-text PDF :55
     
      Contact us:
     Terms of Use  Registration to the website  Logotypes © Steklov Mathematical Institute RAS, 2025