Software tools
Several special-purpose programs are needed to help with the process of developing new programs. They are sometimes called software tools because they are used to build programs. Examples of basic software tools include an editor, a compiler, and an interpreter.
Initially, you use an editor as you type a program into a computer and store it in a file. There are many different editors with many different features. You should become familiar with the editor you will use regularly because it can dramatically affect the speed at which you enter and modify your programs.
Each time you need to make a change to the code of your program, you open it in an editor. After editing and saving your program, you attempt to translate it from high-level code into a form that can be executed. That translation may result in errors, in which case you return to the editor to make changes to the code to fix the problems. Once the translation occurs successfully, you can execute the program and evaluate the results. If the results are not what you want (or if you want to enhance your existing program), you again return to the editor to make changes.
The translation of source code into (ultimately) machine language for a particular type of CPU can occur in a variety of ways. A compiler is a program that translates code in one language to equivalent code in another language. The original code is called source code, and the language into which it is translated. A high-level expression and its assembly language and machine language equivalent High-Level Language Assembly Language Machine Language
a + b 1d [%fp–20], %o0
1d [%fp–24], %o1
add %o0, %o1, %o0
...
1101 0000 0000 0111
1011 1111 1110 1000
1101 0010 0000 0111
1011 1111 1110 1000
1001 0000 0000 0000
...
called the target language. For many traditional compilers, the source code is translated directly into a particular machine language. In that case, the translation process occurs once (for a given version of the program), and the resulting executable program can be run whenever needed.
An interpreter is similar to a compiler but has an important difference. An interpreter interweaves the translation and execution activities. A small part of the source code, such as one statement, is translated and executed. Then another statement is translated and executed, and so on. One advantage of this technique is that it eliminates the need for a separate compilation phase. However, the program generally runs more slowly because the translation process occurs during each execution.
The process often used to translate and execute Java programs combines the use of a compiler and an interpreter. The Java compiler translates Java source code into Java bytecode, which is a representation of the program in a low-level form similar to machine
language code. The Java interpreter reads Java bytecode and executes it on a specific machine.
No comments:
Post a Comment