Integrating a compiler into a programmer’s editor
The front half of the Unicon compiler—loosely covered from Chapter 2, Programming Language Design, up to Chapter 5, Syntax Trees, in this book—was integrated into the Unicon IDE, known as ui
. The Unicon frontend consists of three major components: a preprocessor, a scanner (also called a lexical analyzer), and a parser. While we discussed scanners and parsers in detail in Chapters 3 and 4, we have not discussed preprocessors, which implement symbolic macro substitutions and provide the ability to select platform-specific code at compile time. Preprocessors are a major subject in the next chapter.
In the Unicon translator, these components are called from a main()
procedure. The translator opens, reads, and writes files in the filesystem to perform its I/O, providing feedback to the user by writing text to standard output or a standard error on a console or terminal window. In an IDE, the compiler components...