Preview

Compiler and Interpreter

Good Essays
Open Document
Open Document
1182 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Compiler and Interpreter
Definition of Compiler
Definition: A compiler is a computer program that transforms human readable source code of another computer program into the machine readable code that a CPU can execute.
The act of transforming source code into machine code is called "compilation". This is the opposite to the process of interpretation.
Definition of Machine Code
Definition: Machine code is the name for the Instructions that a CPU can execute. It's rather difficult to read as it is just numbers in memory. There are programs that can convert the numbers back into assembly language but unless you are pretty skilled or trying to break a protection scheme, there is little use or need for it.

Definition of Interpreter
Definition: In computing, an interpreter is a computer program that reads the source code of another computer program and executes that program.
Because it is interpreted line by line, it is a much slower way of running a program than one that has been compiled but is easier for learners because the program can bestopped, modified and rerun without time-consuming compiles.
Examples: The compiled program took ten minutes to run to completion. The interpreted program took an hour.

Definition of Source Code
Definition: Source code is the human readable instructions that a programmer writes. Here is an example of some C++ code void Rectangle::MoveTo (int newx, int newy)
{
x = newx; y = newy;

About Compilers and Interpreters
Before the Java and C# programming languages appeared, computer programs were only compiled or interpreted. Languages like Assembly Language, C, C++, Fortran, Pascal were almost always compiled into machine code. Languages like Basic,VbScript and JavaScript were usually interpreted.
So what is the difference between a compiled program and an Interpreted one?
Compiling
To write a program takes these steps:
1. Edit the Program
2. Compile the program into Machine code files.
3. Link the Machine code files into

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Homework Week 2

    • 743 Words
    • 3 Pages

    A compiler translates one computer language into another. It also pics up errors in the program being put together.…

    • 743 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    What is used to translate high level language programs to machine language (or machine code)? Compiler…

    • 738 Words
    • 3 Pages
    Good Essays
  • Good Essays

    alan turing

    • 794 Words
    • 4 Pages

    A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will often start with a pseudocode description, and then "translate" that description into the target programming language and modify it to interact correctly with the rest of the program. Programmers may also start a project by sketching out the code in pseudocode on paper before writing it in its actual language, as a top-down structuring approach, with a stepwise…

    • 794 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Copyright © 2012 Pearson Education, Inc. 0-5 Terminology • Machine instruction: An instruction (or command) encoded as a bit pattern d) d d tt recognizable by the CPU • Machine language: The set of all instructions recognized by a machine Copyright © 2012 Pearson Education, Inc. 0-6 3 Machine Language Philosophies • Reduced Instruction Set Computing (RISC) – Few, simple, efficient, and fast instructions – Examples: PowerPC from Apple/IBM/Motorola and ARM • Complex Instruction Set Computing (CISC) –…

    • 783 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Recco Smith Unit 1 HmWrk

    • 1114 Words
    • 4 Pages

    6. What Is the different between a compiler and an interpreter? Interpreter is a program that both translate and execute the instructions in high-level language program. Where as, Compiler is used to translate the high-level language program to a machine language program.…

    • 1114 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Executable file: File containing instructions that tell a computer how to perform a specific task.…

    • 272 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Pseudocode

    • 465 Words
    • 2 Pages

    Pseudocode (pronounced SOO-doh-kohd) is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language rather than in a programming language. Pseudocode is sometimes used as a detailed step in the process of developing a program. It allows designers or lead programmers to express the design in great detail and provides programmers a detailed template for the next step of writing code in a specific programming language.…

    • 465 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    POWER POINT PRESENTATION

    • 3095 Words
    • 12 Pages

    The virtual machine converts each generalized machine instructor into a specific machine instruction or instructions that this computer's processor will understand. Bytecode is the result of compiling source code written in a language that supports this approach. Most computer languages, such as C and C++, require a separate compiler for each computer platform - that is, for each computer operating system and the hardware set of instructions that it is built on. Windows and the intel line of microprocessor architectures are one platform; The Bytecode verifier traverses bytecodes.…

    • 3095 Words
    • 12 Pages
    Satisfactory Essays
  • Better Essays

    The first phase of the compiler, called Lexical Analyzer or Scanner reads the source program one character at a time, carving the source program into a sequence of atomic units called tokens. The usual tokens are identifiers, keywords, constants, operators and punctuation symbols such as comma and parenthesis. Each token is a sub-string of the source program that is to be treated as a single unit. The Lexical analyzer examines successive character in the source program starting from the first character not yet grouped into a token. It may be required to search many characters beyond the next token in order to determine what the next token actually is.…

    • 880 Words
    • 4 Pages
    Better Essays
  • Satisfactory Essays

    Compiling

    • 18744 Words
    • 75 Pages

    gcc -o / -O option flags gcc -o writes the build output to an output file. gcc -O sets the compiler's optimization level. gcc -o option flag gcc -O option flag gcc -o option flag Write the build output to an output file. Syntax $ gcc [options] [source files] [object files] -o output file Example myfile.c: // myfile.c #include void main() { printf("Program run\n"); } Build myfile.c on terminal and run the output file myfile: $ gcc myfile.c -o myfile $ ./myfile…

    • 18744 Words
    • 75 Pages
    Satisfactory Essays
  • Good Essays

    A compiler is a computer program that implements a programming language specification to "translate" programs, usually as a set of files which constitute the source code written in source language, into their equivalent machine readable instructions (the target language, often having a binary form known as object code). This translation process is called compilation. We compile the source program to create the compiled program. The compiled program can then be run (or executed) to do what was specified in the original source program.…

    • 6127 Words
    • 25 Pages
    Good Essays
  • Good Essays

    Basic Compiler Design

    • 51898 Words
    • 208 Pages

    1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 What is a compiler? Interpreters . . . . . . . . . . . . . . . . . . . . . The phases of a compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Why learn about compilers? . . . . . . . . . . . . . . . . . The structure of this book . . . . . . . . . . . . . . . . . . To the lecturer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Acknowledgements…

    • 51898 Words
    • 208 Pages
    Good Essays
  • Satisfactory Essays

    CPU function

    • 584 Words
    • 2 Pages

    Although most tech-savvy people know that the Central Processing Unit is one of the components in the computer, but not many people understand what a CPU actually does. Infact most people would not even know what CPU stands for, if you asked them today. The CPU, or microprocessor, stands for Central Processing Unit. It is a very suitable name because it describes exactly what it does in the computer. The CPU processes instructions that it gathers from decoding the code in programs and other such files. The CPU has four primary functions: fetch, decode, execute, and writeback. In the first step, the CPU retrieves the instruction that it needs to run from program memory. Each instruction in a program (which contains millions of instructions) is stored at a specific address. The CPU has a program counter, which keeps track of the CPU’s position in the program “more specifically, the address of the instruction that the CPU is accessing”. For the next step, it is important to know no matter what code a program is written in, the compiler for that specific language is broken down to the Assembly Language. The Assembly Language is a language that the CPU understands, but may vary to different CPU’s. The “assembler” translates Assembly Language into binary code, which the CPU can manipulate to execute the instructions it is given. Based on the instructions given, the CPU can do one of three things: 1) using the Arithmetic Unit, the CPU can calculate extremely complicated mathematical equations; 2) move data from one memory location to another; 3) jump to different addresses in the program based on decisions made by the CPU itself. Typically, each of actions taken by the CPU produces some sort of output. The CPU takes this output and writes it into the computer’s memory. When these four steps have been completed, the Program Counter moves onto the next instruction and repeats the entire…

    • 584 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Compiler Construction

    • 376 Words
    • 3 Pages

    Compiler-a program that translates an executable program in one language into an executable program in another language…

    • 376 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Top Tech Trends of 2012

    • 511 Words
    • 4 Pages

    a.) Draw a DFA that accepts all strings in (a + b)* that do not contain bababb as a substring…

    • 511 Words
    • 4 Pages
    Good Essays