Atitit. Comparison of programming languages and natural languages and the future development of programming languages, atitit Natural Language
Atitit. Comparison of programming languages and natural languages and future development of programming languages
1. The word interval depends on space, and the programmed word interval depends on the demarcation character... 1
2. Statement delimiters: The natural language uses commas, and the programming language uses semicolons (;) 1.
3. line feed 1
4. Paragraphs and fun method2
5. context 2
6. Operation generics 2
7. interchangeable between verb and Noun 2
8. Word Class judgment 3
8.1.1. Form mark of word class division 3
8.1.2. the pronoun in natural language (You, Me, him, and so on) is like the "point" in programming language )". 4
8.2. Such questions seem to be "expressions" including functions in programming languages ". 4
8.3. Where is the "ultimate" of statement analysis? 4
9. Lexical check 4
10. syntax check 5
11. A type system. 'Token' is often used in natural languages, and 'instance' is often used in programming languages '. 5
12. ref6
1. The interval between words depends on spaces, and the interval between programmed words depends on delimiters ..
Parentheses, comma, stop periods
2. Statement delimiters: Use commas for natural language and semicolons for programming language 3. line feed
Natural languages are rarely intermediate... many programming languages ..
Author: nickname: old wow's paw (full name: Attilax Akbar Al Rapanui Attila Akba Arla Panui) Name: AI long, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://www.cnblogs.com/attilax/
4. Paragraph and fun method
Programming uses fun method to define paragraphs ..
5. Context-related
Both programming language and natural language are context-related... business perspective...
The vast majority of ast technologies are still contextual.
6. Operation generics
Natural Language has some "generic verbs", such as "playing", "Engaging", "dry", "get" and "take" in English. Their further meanings are determined by the objects involved in these verbs. For example, "playing" in "sweater" should be understood as "knitting", and "playing" in "playing basketball" should be understood as "playing ", in "Open Water", "hit" should be understood as "get", and so on.
L
In pair-oriented
In the object-oriented programming language, there are similar Dynamic Binding mechanisms: the specific meaning of a function name or subroutine name must be determined at runtime based on the type of the involved object at the time.
Data: constant and variable name. They correspond to nouns in natural language.
L others: Symbols used to indicate the relationship between tokens, such as if and then. They correspond to natural language connectors, exclamation points, and so on.
7. interchangeable between verb and Noun
In natural language, there is a striking phenomenon, that is, the call between nouns and verbs ". This is because the word or token is used to express the concept, and a concept often has multiple aspects. Therefore, natural language often uses the same "symbol" to express different sides. For example, "dingtalk" is a noun but can be converted and used as a verb: I pin the painting to the wall.
Ten functions are used for programming. No fun trans as data ..
8. Word Class judgment
From the perspective of syntax analysis, the basis for classifying words or tokens is its syntax function. From the perspective of language users, it is their usage. Therefore, it is vital to judge the category of a word or token.
In natural language or programming language, there are basically two methods to determine the category of a word or token: the morphological symbols carried by the dictionary and word itself.
Information provided in the dictionary
In programming languages, there are two types of "dictionaries" provided to determine a token category:
1. An external Dictionary defined by the Language "A prior. For example, keywords and reserved words.
2. Another is the internal dictionary temporarily defined by the programmer (user), which is the declaration in the program.
8.1.1. Form mark of word class division
If we can determine which type of word or token belongs to from the perspective of "Writing by author, or from the perspective of "Reader understanding", it can greatly reduce the chance of errors.
In some programming languages (such as Visual Basic), if a variable is not declared anywhere, its type can also be seen from the shape of the variable name. For example, what is the variable whose name ends with %? Integer ?, What are the variables whose names end? String ?, What are the variables whose names end? Floating Point Number? And so on.
In English, there is a similar mechanism to some extent. For example, the term ending with tion and ing is basically a noun. The term ending with-lize is basically a noun. The end of "-ful" is basically an adjective. The approximate ending with-ly is an adverbs.
There is no way to add the suffix because square characters are used in Chinese. Therefore, we believe that this phenomenon makes it difficult to process Chinese computers. However, it cannot be said absolutely. In some cases, Chinese still have "morphological signs. For example, adding "very", "still", and so on before a noun is generally used to modify the Adverbs of adjectives, that is, pointing out in the "form: this term has been converted into an adjective. For example, "students say that I am very young in this dress .", "The program we rehearsed is still very life-consuming .",
8.1.2. the pronoun in natural language (You, Me, him, and so on) is like the "point" in programming language )".
However, in natural language, there is no obvious explanation: from now on, "he" represents "James" until new statements are made. The point of each specific pronoun is determined based on the association between the prefix and prefix meanings of sentences in the sentence domain.
8.1. Such questions seem to be "expressions" including functions in programming languages ". 8.2. Where is the "ultimate" of statement analysis?
When analyzing statements in computer programs, the compiler of computer language always needs to analyze the "terminator" defined in the syntax rules.
9. Lexical check
From the lexical point of view, there are certain rules for the synthesis of words by phoneme and phoneme. For example, the Chinese 'bi' word, as a phoneme, has a restriction when combined with other phoneme into a word. It must be a monophoneme. Such as: bikong, blue, green; but, biyundun, bibao blue and so on are not legal. The words in the programming language (identifier) also have similar strict rules. For example, any identifier must start with a letter or underscore. For example, bilan and _ blian are valid identifier, while 23 bilan and @ bilan are invalid. No identifier must contain spaces. Otherwise, it is invalid.
10. syntax check
From the perspective of syntax, there are clauses similar to natural languages: if x <y then print x + y;
If two identifiers are not equal and x is smaller than y, add the numbers represented by x and y, and print the results.
From the semantic point of view, any identifier can be defined as a different type. For example, name can represent 'zhang san', and age can represent 25.
String name = 'zhang san ';
Syntax and semantics definitions in programming languages are very strict and clear and cannot be ambiguous. For example, the definition of a single and multiple numbers,
In Chinese, it is incomplete. Only when it refers to a human entity, it can be 'use' and the usage is very complicated. English is simpler and expressed in the form of s. However, some words have the same singular and plural forms, such as equipment. Some Words have only the plural and have no singular forms, such as alms. It is impossible to judge from the form as a single and multiple numbers.
The programming language has no such problem:
Any identifier that defines a product word is a singular noun. The plural noun requires a specific word class, usually called an array or a 'table '. For example
11. A type system. 'Token' is often used in natural languages, and 'instance' is often used in programming languages '.
These are just similarities and differences between programming languages and natural languages. I think there is a type system between them.
When talking about types, we need to introduce another term. Natural languages often use 'Token' and programming languages often use 'instance '. We often repeat what we have already said
Of course, we sometimes need to distinguish between types and instances. The natural language method is to add a qualified word. Your friend just wanted a piece of sugar. You said, it wasn't for you to eat it, but for that piece (of course, in this situation, you must have the body language assistance: you have to point to a specific sugar block ). 'Ta' and 'A' are still vague and must be clear. I'm afraid more restrictions and descriptions will be added.
12. ref
Comparison between natural language and machine language
Some common points of natural language and programming language .htm