1. Introduction

Usually, in computer programing, there are several stages of software program development. These stages are grouped as compile time and runtime. In this tutorial, we’ll try to explain the concept behind each of these terms and explore various aspects of it.

2. Software Program Development Stages

The following figure explains the stages involve during the software program coding. This is to provide context and how the stages are related.   Compile tme vs runtime Compile time is the period when the programming code (such as C#Java, C, Python) is converted to the machine code (i.e. binary code). Runtime is the period of time when a program is running and generally occurs after compile time.

3. Compile Time

We use high-level programming languages such as Java to write a program.  The instructions or source code written using high-level language is required to get converted to machine code for a computer to understand. During compile time, the source code is translated to a byte code like from .java to .class.  During compile time the compiler check for the syntax, semantic, and type of the code.

3.1. Inputs and Outputs

Inputs and outputs during compile time are the following:

3.2.  Errors

During compile time errors occur because of syntax and semantic. The syntax error occurs because of the wrong syntax of the written code. Semantic errors occur in reference to variable, function, type declarations and type checking.

4. Runtime

A program’s life cycle is a runtime when the program is in execution. Following are the different types of runtime errors:

  • Division by zero – when a number is divided by zero (0)
  • Dereferencing a null pointer – when a program attempts to access memory with a NULL
  • Running out of memory – when a computer has no memory to allocate to programs

5. Differences

The following table shows a comparison between compile time and runtime.

Rendered by QuickLaTeX.com

6. Conclusion

In this article, we discussed an overview of the compile-time and runtime. First, we discussed the stages of translation of source code to machine code for java and C#.  We then talked about the differences between compiler time and runtime. To conclude, knowing about the translation stages, is beneficial in understanding the source of errors for a computer program.

Comments are closed on this article!