If we stop and look around, we will notice that languages (in general) have rules.
In the English language, if we want to be good speakers, we must be good at grammatical rules. When we think about coding, when we want to create a utile program, we must follow the "rules" of the programming languages to see it work.
Syntax and semantics are to programming languages as grammar rules are to languages.
Syntax of a programming language
In the software development world, we can apply our logical understanding anywhere, but not syntaxes of programming languages. Why? Because each one has its particularities. In other words, syntax is one of the "rules" of programming languages that we have to follow.
For example, when we see that Java requires semicolons after statements, this is part of the Java syntax.
If we do not align the syntax of our program to the programming language, our program will not run. Here is where we see the importance of following rules.
The semantics of a programming language
In a dictionary, one of the definitions of semantics is:
"The study or science of meaning in language." In other words: study, signs, and interpretation of words. In the end, it helps to understand, to comprehend (and a little more) clearly.
Semantics works to describe structures in a programming language. We have to write our program in the correct format to run the program.
How would you simplify this concept?
semantics. (n.d.) American Heritage® Dictionary of the English Language, Fifth Edition. (2011). Retrieved June 18 2022 from The Free Dictionary.
Oldest comments (0)