Syntax and semantics are principal concepts to understand programming languages. Syntax determines how a language looks like, and semantics fills the inside. If we consider a programming language as a human, we can say that syntax is one’s appearance, and semantics is one’s thoughts. Programmers write programs according to syntax. Syntax decides characters used in source code. Once programs are written, semantics decides what each program does. (...) From a theoretical perspective, syntax and semantics are all
of a programming language.
For programmers, syntax and semantics are not the only elements of a programming language. First, the standard library of a language is another element. The standard library provides various utilities required by applications: data structures like lists and maps, functions handling file and network IO, and so on.
From a practical perspective, a programming language consists of syntax, semantics, a standard library, and an ecosystem.
Each language seems very different from the others, but it is actually not the case. Precisely speaking, their insides are quite the same, while their appearances look different. They look different because their syntax and standard libraries, which determine the appearances, are different. However, their insides, the semantics, fundamentally share the same mathematical principles.
People who cannot distinguish syntax and semantics believe that they should learn the whole language again when the syntax changes. On the other hand, people who can distinguish syntax and semantics know that semantics remains the same even if syntax may vary.