Send Close Add comments: (status displays here)
Got it!  This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
Edit-compile-run in more detail
by RS  admin@robinsnyder.com : 1024 x 640


1. Edit-compile-run in more detail
We now cover each step of the edit-compile-run cycle in more detail using the Lua programming language. But first, we need to cover some terminology. A computer program is a specification of a computation.

A computer program is sometimes called the source text. A program in text form is easy for human programmers to work with and understand.


2. Computations
A program is never a goal in itself. The purpose of a program is to evoke computations and the purpose of the computations is to establish a desired effect. Edsger Dijkstra (computer scientist)

Information sign More: Edsger Dijkstra

3. Programming languages
A programming language is a notation for specifying a computation.

Some common computer programming languages include the following. In this course, we will use the programming language Lua.

4. Requirements specification
Before you can create a program, you need to determine the requirements for the program, determine a set of specifications, and plan and create a design for the program.

For a beginning programming course, you are usually given the requirements, the specifications, and a way in which to design the program that you are to create.

Your job, then, is to write a program that accomplishes the requirements according to the specifications. In later courses, you may be required to do the requirements and/or specifications in addition to the implementation.

5. First program
Whenever learning a new programming language or system, the first program you attempt should be very simple.

Our first program will be a program that has no input and outputs text to the standard output stream, which is usually the screen.

The first program is often called the "Hello, World" program. This program has no input and outputs the text "Hello, World" to the standard output, usually the screen. What is the first program that you should attempt when learning a new programming language and/or system? Explain.

6. Program text
Here is the text for a Lua program that outputs the text "Hello, World".

to be added For now, we will not concern ourselves with the structure of the program, how it works, why it works, etc.

We will only be concerned with the mechanics of the three steps of the edit-compile-run cycle.

7. Step 1. Create/modify the program
The first step is to create and/or modify a program to meet the requirements using a text editor. This is called editing a program.

In Windows, the Notepad++ text editor is popular.

In Linux, a popular command line editor is nano.

There are many other very good text editors.

Any changes made must be saved before going to the next step. Most programming systems have editors that "know" something about the program as text. Notepad knows nothing about your program.

8. Compile the program
An executable program containing machine instructions in binary form, called binary code, that is needed in order to have a microprocessor (or another program) execute the program (i.e., execute the instructions). A compiler translates a source program in text form into an object program that contains machine instructions..

The object program is sometimes called the target code.

9. Programming language levels
The programming process is built an layered abstractions.

10. Programming language
Here is a BASIC programming statement to output the character "A".
Print "A" ' output the character "A"

The statement needs to be translated, or compiled, to assembly language code. Here, 8086 assembly language code will be used.

11. CPU registers

12. Low level assembly language

MOV DX,41h ; move character "A" = 65d = 41h to register DX MOV AH,2 ; move 2 to register AH INT 21h ; call DOS API at software interrupt location 21h

The assembly language code then needs to be translated, or assembled, into machine language.

13. Machine language in hexadecimal
In hexadecimal, the machine language code has a very close visual relationship with the assembly language instructions.
BA4100 ; "MOV DX" is BAh , "41h" == "4100" (16 bits) B402 ; "MOV AH" is B4h , "02h" == "02" ( 8 bits) CD21 ; "INT" is CDh , "21h" == "21" ( 8 bits) DOS API


14. Machine code in binary
In binary, the machine language code is in a form that the microprocessor can recognize and execute.
10111010 01000001 00000000 ; BA 41 00 10110100 00000010 ; B4 02 11001101 00100001 ; CD 21


15. Microprocessor execution
The microprocessor can execute the binary machine code when it has been converted to high (1) and low (0) voltage levels.


16. Link the program
Most programs consist of many different parts and modules. In order to create an executable program, these different parts must be combined together to form an executable file.

17. Linker
A linker is a program that combines object programs containing machine instructions into a single executable program file that can be run.

18. Executable programs
An executable program is a program that can be run.

The default file extensions for most Windows executable files that contain binary machine instructions are .exe or .dll.

A .dll program is a DLL (Dynamic Link Library) program that, in Windows, contains executable binary machine instructions that are shared by other programs.

For example, the Windows operating system consists of a large number of .dll programs. What is the purpose of a linker in a programming system? Explain by way of a specific example.

19. Java execution model
The Java execution model features a JIT (Just In Time) compiler that verifies the compiled Java byte-code (i.e., byte-string) before running the code.

This allows Java to run on many computers with some level of security (especially for Internet-based applications).

20. Integrated development environments
The edit-compile-run process/cycle can get very repetitive and tedious.

An IDE (Integrated Development Environment) contains a convenient user-friendly visual interface for accomplishing the edit-compile-run cycle as well as providing features for debugging programs, etc. Many graphical editors provide some form of development environment.

21. End of page

by RS  admin@robinsnyder.com : 1024 x 640