關(guān)于編程語言的思考(上)Thinking of the Programming Language (Part 1)

問題 Problems

  • 什么是編程語言?有哪些?各自是什么類型?What is programming language? How many programming language we have? How many types?

  • 語言的基本組成要素是什么?What's the core foundations of programming language?

  • 為什么有那么多的編程語言? Why there are so many programming language?

  • 語言之間的相同點(diǎn)和異同點(diǎn)是什么?What are the similarities and differences among those languages?

  • 為什么有時候創(chuàng)造一門新語言能更好的解決問題?Why sometimes creating a new language is a better way to solve problems?

  • 如何實現(xiàn)一門編程語言?How to implement a programming language

  • 我學(xué)過哪些編程語言? How many programming languages I have learned?

      - C
      - C++
      - 匯編
      - Java
      - C#
      - HTML/CSS
      - JavaScript
      - Swift
      - Cobol、JCL
      - PHP
      - Objective-C
    

什么是編程語言?What is programming language?

人類語言的一大目的是為了溝通,計算機(jī)編程語言也是如此。只是編程語言的溝通對象是人與機(jī)器。計算機(jī)本身很“笨”,因為它所做的所有事情[ [1] ]都需要命令指揮。而這些命令就是人們使用編程語言來編寫的。

One of the main function of human language is to communicate, so does the computer programming language. But it's a communication between the computers and human beings. The computer is quite "stupid" since it only does the instructions which have been told. Those instructions, written by human beings, are programming languages.

語言類型 What's the type of programming languages?

你可能聽過不少語言的分類標(biāo)準(zhǔn),比如,從語言的等級來分,有低級語言(匯編)、中級語言(C)和高級語言(C++,java)。從語言的實現(xiàn)角度來分,有編譯型語言(C、C++,Pascal)、解釋型語言(php,lisp)和以上兩者的混合型語言(Java,Python)。從語言類型是否在編譯時確定,也可以分為靜態(tài)語言(C++,Java)和動態(tài)語言(JavaScript)。或者,我們可以從編程風(fēng)格來分,有面向?qū)ο蟆⒑瘮?shù)式和邏輯式。當(dāng)然一種語言可能屬于其中的幾種類別。

You may have heard different standard of classification.For example, we can divide them from the language level: low level, medium level and high level. We can see from the language Implementation: Interpreted、Compiled、Hybrid Language Implementations. Or we can divide from the style: Imperative/Object-Oriented Programming, Functional Programming, Logic Programming.

舉個例子,如何區(qū)分編譯型和解釋型呢?一個程序,要讓計算機(jī)執(zhí)行,必須是計算機(jī)所能理解的形式。編譯器可以把用某種編程語言寫成的程序(源語言),轉(zhuǎn)換成另一種編程語言(目標(biāo)語言)。解釋器不是通過直接翻譯,而是直接一行一行的解釋執(zhí)行。
How to distinguish between compiled language and interpreted language? A program must be translate to the form which the computer can execute. The complier does the translation from the source language to target language. While the Interpreter directly execute the operations in the source program.

編譯器 Complier:

編譯器.jpg

解釋器 Interpeter:

解釋器.jpg

wiki分類:

programming language

圖片來源

編譯原理課上,老師推薦學(xué)習(xí)四門語言,C語言,匯編,腳本語言,Lisp。課后問他為什么沒有面向?qū)ο蟮恼Z言,他說面向?qū)ο笫且环N設(shè)計。不過,我自己還是堅持面向?qū)ο蟮恼Z言是必學(xué)的。

語言的基本組成要素是什么?What’s the core foundations of programming language?

因為我個人接觸語言的局限性,目前只做了如下的思考,歡迎各位討論,提出自己的見解。
The following thinking is based on my own limit experience with programming language, so please feel free to offer your own opinions and discuss with me.

學(xué)習(xí)一門語言,會學(xué)習(xí)其語法,以及其對應(yīng)的語義。語法定義了程序的組織書寫形式。語義描述程序?qū)⑷绾伪粓?zhí)行。

Syntax of a programming language determines the well-formed or grammatically correct programs of the language. Semantics describes how or whether such programs will execute.

  • Syntax is how things look
  • Semantics is how things work (the meaning)

過程 process

  • 表達(dá)式 expression

    • 語句 statement
      • 聲明 declare 常量與變量
      • 賦值
    • 判斷 judge
      • if-else
      • switch-case
    • 循環(huán) loop
      • while / do while
      • for
      • if
  • 操作operation : + - * / % :? || && ! >> << 等等

  • 數(shù)據(jù)類型 data type (the value and the operation)

    • 原始類型 primitive type
      • 數(shù)值型 numberic: short,int,float,double,long
      • 字符 string:char,string
      • 空 nil
    • 高級類型 advanced type
      • enumeration
      • dictionary
      • array
      • struct
      • generic
  • 函數(shù) function

    • type-return
    • name

面向?qū)ο?object-oriented

  • 類 class
    • attribute
    • function(method)
    • construct-deconstruct
  • 繼承 inherit
    • 單繼承、多繼承
  • 多態(tài)
    • 重載
  • 接口 interface
  • 協(xié)議 delegate

SCIP:

  • 過程抽象
  • 數(shù)據(jù)抽象

Reference:

待續(xù)......
TBA...


作者「[AzureYu]」
文章聲明:自由轉(zhuǎn)載-非商用-非衍生-保持署名 | BY-NC-SA


  1. 從本質(zhì)上來看,計算機(jī)能做的事情就是計算,不是嗎?Actually, the computer can do nothing but computation, isn't it? ?

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 228,923評論 6 535
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 98,740評論 3 420
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 176,856評論 0 380
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,175評論 1 315
  • 正文 為了忘掉前任,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 71,931評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 55,321評論 1 324
  • 那天,我揣著相機(jī)與錄音,去河邊找鬼。 笑死,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,383評論 3 443
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 42,533評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 49,082評論 1 335
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 40,891評論 3 356
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 43,067評論 1 371
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,618評論 5 362
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 44,319評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,732評論 0 27
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 35,987評論 1 289
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,794評論 3 394
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 48,076評論 2 375

推薦閱讀更多精彩內(nèi)容