RUS  ENG
Full version
JOURNALS // Prikladnaya Diskretnaya Matematika // Archive

Prikl. Diskr. Mat., 2017 Number 37, Pages 90–99 (Mi pdm592)

Mathematical Foundations of Informatics and Programming

Effective translation for LL(1)-grammar in the example of a programming language

Yu. L. Kostyuk

Tomsk State University, Tomsk, Russia

Abstract: Top-down analysis algorithms are the most useful for implementing translators for programming languages. The analysis methods based on the LL(1)-grammar assume that the generating rules of the grammar are previously transformed into a non-strict normal Greibach form. The transformed generating rules are written in an analyzer table. To convert an input string of characters to an object language, a special program for generating individual elements of the object language should be created for each generating rule. The development of the set of such programs is rather a complex and voluminous task when a translator is created. In this article, we propose a method for constructing semantic programs implementing the generation of elements of the object language when each semantic program is associated with the separate symbols in the generating rule but not with the generating rule as a whole. As a result, the semantic programs are extremely simple and convenient to be implemented. The method is described for an exemplifying programming language which is translated into a reverse Polish notation.

Keywords: translation, LL(1) grammar, reverse Polish notation, programming language.

UDC: 32.973.26-018.2

DOI: 10.17223/20710410/37/7



Bibliographic databases:


© Steklov Math. Inst. of RAS, 2024