Newest Viewed Downloaded

NoteThe only language understood by a computer is machine language. 電腦唯一懂得語言就是機器語言。

Foundations of Computer Science (計算機概論) Chapter 9 Programming Languages (程式語言)

Outline

9.1 Evolution (演化) 9.2 Building a program (建構一個程式) 9.3 Program execution (程式的執行)

Outline

9.4 Categories of languages (語言的分類) 9.5 A procedural Language: C (程序語言:C)

9.1 Evolution (演化)

Evolution of Computer Languages

機器語言 符號式語言 高階語言 自然語言 (演化中)

Note

The only language understood by a computer is machine language. 電腦唯一懂得語言就是機器語言。

Evolution of Computer Languages

A symbolic language uses symbols to represent various machine language instructions (指令) 一個符號語言使用符號來表示各樣的機器語言指令 Symbolic languages are also called assembly languages 符號語言也可以稱為組合語言

Evolution of Computer Languages

High-level languages are portable (攜帶) to many different computers, allowing the programmer to concentrate (專注) on the application rather then the intricacies (錯綜複雜) of the computer 高階語言可以攜帶到許多不同的電腦上執行,讓程式設計師可以專注於應用,而不是忙於電腦的一些瑣事 High-level languages (高階語言) BASIC, Pascal, Ada, C, C++, and Java Natural language (自然語言)

Program in Machine Language (機器語言)

00000000 00000100 0000000000000000 01011110 00001100 11000010 0000000000000010 11101111 00010110 0000000000000101 11101111 10011110 0000000000001011 11111000 10101101 11011111 0000000000010010 01100010 11011111 0000000000010101 11101111 00000010 11111011 0000000000010111 11110100 10101101 11011111 0000000000011110 00000011 10100010 11011111 0000000000100001 11101111 00000010 11111011 0000000000100100 01111110 11110100 10101101 11111000 10101110 11000101 0000000000101011 00000110 10100010 11111011 0000000000110001 11101111 00000010 11111011 0000000000110100 00000100 0000000000111101 00000100 0000000000111101 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Program in Symbolic Language (符號語言)

Entry main, ^m subl2 #12,sp jsb C$MAIN_ARGS movab $CHAR_STRING_CON pushal -8(fp) pushal (r2) calls #2,read pushal -12(fp) pushal 3(r2) calls #2,read mull3 -8(fp),-12(fp),- pushal 6(r2) calls #2,print clrl r0 ret 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Program in C++ Language (C++語言)

/* This program reads two integer numbers from the keyboard and prints their product. */ #include int main (void) { // Local Declarations int number1; int number2; int result; // Statements cin >> number1; cin >> number2; result = number1 * number2; cout << result; return 0; } // main 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

9.2 Building a Program (建構一個程式)

Three Steps in Building a Program

Writing and editing the Program 撰寫與編輯程式 Text edit (文字編輯器) Source file (原始碼) Compiling the program 程式編譯 Preprocessor (前處理器) Translator (轉譯器) Object module (目的碼模組) Linking the program with the required library modules 將程式與所需要的函式模組連結 Subprogram (副程式) Linker (連結器)

Building a Program

文字編輯器 編譯器 前處理器 轉譯器 連結器 系統函式庫 目的碼 原始碼

語言轉譯程式

Assembler (組譯器) 組合語言 Interpreter (直譯器) Basic Script language (JavaScript, VBScript) Python Perl Compiler (編譯器) FORTRAN COBOL Pascal C C++ Ada Java

9.3 Program Execution (執行的程式)

Program Execution

載入 輸入 輸出 Loader (載入器) Program (程式)

9.4 Categories of Language (語言的分類)

Categories of Language

Computer Language 電腦語言 Procedural 程序 Object- Oriented 物件導向 Functional 函式 Declarative 宣告式 Special 特別

Procedural Language (程序語言)

A procedural language is a set of instructions that are executed one by one from beginning to end unless an instruction forces the control elsewhere 一個程序語言是一組指令的集合,它們從頭到尾一一被執行,除非一條指令強迫控制到別處 When programmers need to solve a problem using one of the procedural language, they should know the procedure to follow 當程式設計師要用程序語言解決問題時他們要先知道依序的程序 The programmer should carefully design an algorithm, and the algorithm should be carefully translated to instruction 程式設計師該仔細的設計演算法,而演算法也應該小心的被轉換成指令

Showing 1 - 20 of 68 items Details

Name: 
ch09
Author: 
Shou-Li
Company: 
N/A
Description: 
NoteThe only language understood by a computer is machine language. 電腦唯一懂得語言就是機器語言。
Tags: 
the | language | and | program | num | that | function | procedural
Created: 
9/15/2005 6:07:57 PM
Slides: 
68
Views: 
0
Downloads: 
0
Rating: 
0


> Comment



Share this presentation
|

Comments

Share this presentation:

|
Sitemap