問題 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:
解釋器 Interpeter:
wiki分類:
編譯原理課上,老師推薦學(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
- 語句 statement
操作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
- 原始類型 primitive type
-
函數(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
-
從本質(zhì)上來看,計算機(jī)能做的事情就是計算,不是嗎?Actually, the computer can do nothing but computation, isn't it? ?