Syntax vs. Semantics

Source: Internet
Author: User

Syntax and semantics are often used in programming. What are the meanings and differences between them?

Syntax is the syntax, and semantics is the semantics. Literally, the former focuses on the "rule", while the latter focuses on the "meaning ". Taking SQL statements as an example, in Oracle, parsing SQL statements requires a syntax check before performing a semantic check. During the syntax check, the system will determine whether the SQL statement you write contains any typos, for example, the SELECT statement is written as selct; the meaning is to determine what the purpose of your SQL writing is-whether it is to be queried or personal data.

 

Code
What is the difference between syntax and semantics.

This question cocould be answered merely by taking a definition out
Any dictionary or cognitive psychology text book. John R. Anderson
Defines the two in his book "cognitive psychology and its
Implications "(1995),
Semantics-grammatical rules for assigning meaning to a sentence.
Syntax-grammatical rules for specifying correct word order and
Inflectional structure in a sentence.
Doing this does not really give a clear explanation of
Differences between the two. It is beter explained if the features
The two are already ed more thoroughly.
Word Order is the basic principal of syntax, those trying
Understand what is written use the syntactic cues of word order
Help give the sentence structure and meaning. Word Order gives
Sentence the correct intonnation especially with the use of funtion
Words such as, a and who, due to this its meaning becomes much
Clearer. If the words of a sentence were not in the correct order
There wocould be no syntactic cues as to the meaning of the sentence.
This point leads on to the difference between syntax and semantics.
Semantics are an individuals own interpretation of the meaning of
"Sentence" based on their prior knowledge. Therefore a sentence that
Seemingly makes no syntactic sense, can have meaning when using
Semantic cues. The sentence "baby milk drinks" does not have
Syntactic meaning, but through semantics most people wowould interpret
It as meaning "baby drinks milk" as our prior knowledge tells us
That a baby drinks milk, and therefore we can find a meaning from
Key words.
The difference between syntax and semantics is that syntax is only
Concerned with what is linguistically and grammatically correct,
Semantics requires all ones prior knowledge which, as Anderson
States, "goes far beyond anything which is language specific ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.