問題 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?
語言之間的相同點和異同點是什么鉴嗤?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?
人類語言的一大目的是為了溝通炕置,計算機編程語言也是如此荣挨。只是編程語言的溝通對象是人與機器。計算機本身很“笨”朴摊,因為它所做的所有事情[ [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?
你可能聽過不少語言的分類標準甚纲,比如口锭,從語言的等級來分,有低級語言(匯編)介杆、中級語言(C)和高級語言(C++鹃操,java)。從語言的實現(xiàn)角度來分春哨,有編譯型語言(C荆隘、C++,Pascal)赴背、解釋型語言(php椰拒,lisp)和以上兩者的混合型語言(Java,Python)凰荚。從語言類型是否在編譯時確定燃观,也可以分為靜態(tài)語言(C++,Java)和動態(tài)語言(JavaScript)便瑟±禄伲或者,我們可以從編程風(fēng)格來分胳徽,有面向?qū)ο蠡⒑瘮?shù)式和邏輯式爽彤。當然一種語言可能屬于其中的幾種類別。
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ū)分編譯型和解釋型呢箫爷?一個程序嚷节,要讓計算機執(zhí)行,必須是計算機所能理解的形式虎锚。編譯器可以把用某種編程語言寫成的程序(源語言)硫痰,轉(zhuǎn)換成另一種編程語言(目標語言)。解釋器不是通過直接翻譯窜护,而是直接一行一行的解釋執(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
-
表達式 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ì)上來看近尚,計算機能做的事情就是計算蠕啄,不是嗎?Actually, the computer can do nothing but computation, isn't it? ?