DESIGN OF A TRAINING COMPILER FOR INCREASING THE EFFICIENCY OF LANGUAGE PROCESSORS LEARNING Cover Image

DESIGN OF A TRAINING COMPILER FOR INCREASING THE EFFICIENCY OF LANGUAGE PROCESSORS LEARNING
DESIGN OF A TRAINING COMPILER FOR INCREASING THE EFFICIENCY OF LANGUAGE PROCESSORS LEARNING

Author(s): Dimitar Dimitrov, Ivaylo Penev
Subject(s): Lexis, Semantics, ICT Information and Communications Technologies, Distance learning / e-learning
Published by: Carol I National Defence University Publishing House
Keywords: Training Compiler; Lexical Analyzer; Parser; Semantic Analyzer; Code Generator; Formal Grammars and Languages;

Summary/Abstract: The paper presents the design of a training compiler which is developed for the purposes of education in compilers and language processors in computer science courses. The presented compiler has the following main advantages compared to known training compilers used in various universities – a simplified modular structure and the building of an explicit abstract syntactic tree of the input program. The modules in the compiler structure are lexical analyzer, syntactic analyzer, semantic analyzer and code generator. This separation allows students to effectively study the main stages of compilation - lexical analysis, parsing, semantic analysis and code generation. Building and visualizing an explicit abstract syntax tree helps students to understand the translation of the program into the compiler's front-end and make the transition to the compiler's back-end. The compiler translates a program written in a high-level language into virtual machine code. An interpreter to execute the generated virtual machine code is also presented. The presented design is compared to other known training compilers used in various university courses. The input language is procedure-oriented and is a subset of the C and Java languages, which makes it easier for students to use it. Language has enough resources to solve many practical problems. The input program for the compiler is a sequence of definitions of variables and functions. The language of the training compiler is strongly typed. Variables, constants and expressions are related to a specific type. Input-output operations require a certain type of arguments, arithmetic-logical operations are defined for specific types of arguments and type of returned result. At the end of the paper are presented the results of the work of the training compiler in translating a sample input program to code for a virtual machine. The results demonstrate the output of each compiler module - a token stream, an abstract syntax tree, and a set of virtual machine instructions. The structure of the presented training compiler can be used for different input languages in training on compilers and language processors.

  • Issue Year: 17/2021
  • Issue No: 02
  • Page Range: 29-36
  • Page Count: 8
  • Language: English