PMzone logo

Looking for Something?

Search by Name, Keyword, or Document

Sanctum Sanctorum!

Private and Sacred

Find the Most Relevant Information

Can't find what you are looking for? Check out our Search Forms.

Document Search

To download a document from PMzone, select the document type and enter the name of the document. Input your access code and press SEARCH.

Website Search

To search this website for a topic, enter the word you are searching for and press SEARCH.

Site Search


Search Social Media

Social icons

Compiler Construction Notes

Compilers are extremely complex pieces of software. To develop a reasonably industrial-strength compiler, programmers have to make a few choices concerning the source language, implementation compiler, and the target microprocessor. In our tutorials, we use Ada as the source programming language, the IWBasic compiler as the implementation compiler, and target the Intel IA-32-64 microprocessor architecture using the Windows operating system. Of course, our ultimate goal is to develop the compiler in its own language.

Our Target Audience

We assume the user has no knowledge of assembly language programming, but has some familiarity with a high-level procedural language such as BASIC or C and the C runtime library. We also assume the user has no experience defining new programming languages, constructing compilers, or creating sophisticated tools such as IDEs and debuggers.

Source Programming Language

A source programming language is the set of formal instructions fed into a software application referred to as a compiler. In our tutorials, we use the Ada programming language.

Ada is a new programming language we design in one of our tutorials that has three overriding concerns: program readability, program writeability, and overall program reliability. Readability is a measure of how easy a program can be read and understood. Writeability is a measure of how easily a language can be used to create programs for a specific problem domain. Reliability is a measure of how a program performs to its specifications under all conditions.

Ada is a 64-bit bi-level, general-purpose programming language with built-in verification capabilities. Ada provides a structured programming environment with strong typing, program encapsulation, data abstraction, and high reliability. To facilitate these fundamental goals, Ada employs a highly standardized, syntactically simple grammar designed to enhance readability and facilitate compiler development.

As with any imperative programming language, Ada is focused on storing program instructions, declaring typed objects, elaborating and storing the objects as data, and then manipulating those data using type-specific operations. Adagé operations are further strengthened by the use of packages that separate interfaces from the implementation code and by employing contracts between software components to verify code correctness.

Ada bi-level structure offers two levels of program development. At the high level, Adagé's expressive syntax is specifically designed to free users from the intricate details of the underlying system architecture. At the low level, Ada provides extensive features explicitly designed to allow direct access to system hardware and external libraries using native inline assembly language instructions.

Most importantly, Ada is primary focused on producing correct, error-free code containing no user surprises. To this end, Ada relies on ample quantities of memory space for key language structures to ensure accuracy, contextual language compliance, and program security. The following code stub depicts a simple program demonstrating some of Adagé's high-level syntax.

Implementation Compiler

The particular implementation compiler initially chosen to compile our source code is IWBasic from IonicWind. IWBasic is a full featured 32-bit compiler for the Windows operating system. IWBasic creates small, fast executable and DLL files. This bootstrap compiler is used in our tutorials because it allows mix-mode programming using inline assembly language instructions to be integrated into high-level BASIC code. The ultimate goal is to create a 64-bit compiler using the Ada programming language.

Target Architecture

We have chosen to use the Intel-based x86-64 architecture and Windows operating system as the platform for all our tutorials. The x86-64 architecture is the dominant architecture on personal computers and thus is widely available to the widest audience. However, our initial compiler will be small enough to be easily ported to other architectures and operating systems. As the size of our new language grows, so will the associated portability issues.

End Goal

For the purposes of our tutorials, we define the end goal to be a compiler powerful enough to compile an interactive Windows-based application. Keep in mind that the basic Ada programming language and subsequent compiler will continue to evolve as technologies, updates, and discoveries are entered into the application.

Although constructing a compiler is a very rigorous undertaking, it can be made less complex by initially concentrating on the essential aspects of compilation and freeing the compiler from sophisticated analysis and optimizing requirements. This helps the novice programmer build the inner-workings of a robust compiler without being distracted by the underlying details. This approach gives the programmer a better feel for the compiler's shortcomings and thus provide sufficient motivation for enhancing it.


© 1997 Transtar Management Services, Inc. All rights reserved. Terms of Use