The concept of Programming Languages: Syntax, Semantics and pragmatics
There are 3 things that relate to the concept pemrogramanan language: syntax, semantiks and pragmatic. 3 in teaching this concept uses the analogy of the ordinary language we use everyday.
Syntax
The syntax of a language related to the structure of language. For example, to form a valid sentence in the language we use the structure: [subject] + [verb] + [noun]. By using this structure, we can form a sentence, for example: I eat rice. In connection with the programming language, we must meet the syntax (read: the rules of language structure) so that programs can run. For example, in the BASIC language, to mengassign a variable with a value, we use the Operands '=', but if in Pascal, we use':='. Example in BASIC: a = 1, but in the language Pascal, a: = 1.
Semantic
Semantics of a language describes the relationship between syntax and computational models. Simply put, semantic explain the meaning of the program.
Following analogy. If we use the syntax [subject] + [verb] + [noun], we can produce sentences.
If we generate the sentence I eat rice, so this sentence to meet the rules of syntax. But, if I make a sentence I eat stones, the syntax of this sentence is correct. However, semantically, this sentence does not contain significant meaning.
In connection with the programming language, sometimes there are times when a programmer can not associate syntax computing model. Logic errors can easily occur.
As with the example there is a programming language as follows:
if (a = 5) (
echo 'The value a = 5?;
)
If the program is run, what happens? Depending of what language is used. If the language used is C, then the output comes out is always value a = 5, although a previous variable value other than 5. Why did that happen? That's because the operator '=' in C means mengassign a variable that is to the left with the existing value on the right. In C, the syntax of this operation is correct.
But, if that meant the programmer wants to evaluate the value of a variable, then the logic operators should wear'=='. Thus, the actual program to be
if (a == 5) (
echo 'The value a = 5?;
)
Pragmatic
Pragmatics associated with the ease of implementation and efficiency. In analogy with the language, we can just tell the person "Do not smoke" when there are regulations that prohibit a person smoking in a room. Such a short sentence is enough efficient. But, in other occasions we might use the phrase "Please you do not smoke in here because, according to government regulations in a number XXX XXX stated that smoking in public places will lead to violations of regulations, other than that from the health side ... blah blah blah".
In relation to the programming language, a programmer should be able to ensure efficiency in doing lawyer-coding-an. In the C language, programmers are given the power to allocate memory. As a result, if the programmer negligent in mengontorl variables resulting from the assignment of a pointer, it will be a memory leak. This is caused when a programmer mengcreate a pointer variable, and then delete them, the information is still there in memory, it's just not accessible anymore.
There are 3 things that relate to the concept pemrogramanan language: syntax, semantiks and pragmatic. 3 in teaching this concept uses the analogy of the ordinary language we use everyday.
Syntax
The syntax of a language related to the structure of language. For example, to form a valid sentence in the language we use the structure: [subject] + [verb] + [noun]. By using this structure, we can form a sentence, for example: I eat rice. In connection with the programming language, we must meet the syntax (read: the rules of language structure) so that programs can run. For example, in the BASIC language, to mengassign a variable with a value, we use the Operands '=', but if in Pascal, we use':='. Example in BASIC: a = 1, but in the language Pascal, a: = 1.
Semantic
Semantics of a language describes the relationship between syntax and computational models. Simply put, semantic explain the meaning of the program.
Following analogy. If we use the syntax [subject] + [verb] + [noun], we can produce sentences.
If we generate the sentence I eat rice, so this sentence to meet the rules of syntax. But, if I make a sentence I eat stones, the syntax of this sentence is correct. However, semantically, this sentence does not contain significant meaning.
In connection with the programming language, sometimes there are times when a programmer can not associate syntax computing model. Logic errors can easily occur.
As with the example there is a programming language as follows:
if (a = 5) (
echo 'The value a = 5?;
)
If the program is run, what happens? Depending of what language is used. If the language used is C, then the output comes out is always value a = 5, although a previous variable value other than 5. Why did that happen? That's because the operator '=' in C means mengassign a variable that is to the left with the existing value on the right. In C, the syntax of this operation is correct.
But, if that meant the programmer wants to evaluate the value of a variable, then the logic operators should wear'=='. Thus, the actual program to be
if (a == 5) (
echo 'The value a = 5?;
)
Pragmatic
Pragmatics associated with the ease of implementation and efficiency. In analogy with the language, we can just tell the person "Do not smoke" when there are regulations that prohibit a person smoking in a room. Such a short sentence is enough efficient. But, in other occasions we might use the phrase "Please you do not smoke in here because, according to government regulations in a number XXX XXX stated that smoking in public places will lead to violations of regulations, other than that from the health side ... blah blah blah".
In relation to the programming language, a programmer should be able to ensure efficiency in doing lawyer-coding-an. In the C language, programmers are given the power to allocate memory. As a result, if the programmer negligent in mengontorl variables resulting from the assignment of a pointer, it will be a memory leak. This is caused when a programmer mengcreate a pointer variable, and then delete them, the information is still there in memory, it's just not accessible anymore.
0 Komentar untuk "The concept of Programming Languages: Syntax, Semantics and pragmatics"