DEV Community

Milena
Milena

Posted on

1

Syntax error x semantics error

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.

Image description

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.

Image description

How would you simplify this concept?

Reference

semantics. (n.d.) American Heritage® Dictionary of the English Language, Fifth Edition. (2011). Retrieved June 18 2022 from The Free Dictionary.

Top comments (0)

Great read:

Is it Time to go Back to the Monolith?

History repeats itself. Everything old is new again and I’ve been around long enough to see ideas discarded, rediscovered and return triumphantly to overtake the fad. In recent years SQL has made a tremendous comeback from the dead. We love relational databases all over again. I think the Monolith will have its space odyssey moment again. Microservices and serverless are trends pushed by the cloud vendors, designed to sell us more cloud computing resources.

Microservices make very little sense financially for most use cases. Yes, they can ramp down. But when they scale up, they pay the costs in dividends. The increased observability costs alone line the pockets of the “big cloud” vendors.

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay