What is syntax? Easily explained
The basis of the grammar of every language is the syntax. This also applies to the language of the programs, the code. We can easily explain what syntax means in connection with programming.
General definition of syntax
- Syntax is a sub-area of grammar and describes the teaching of sentence structure. It determines how meaningful sentences are created from individual components - the words.
Syntax in the program code
- When programming, the syntax defines formal rules about the permissible language elements of a programming language. It also regulates the extent to which these elements can be used in a program.
- The programming language can be understood as an interface between humans and computers.
- Just as you as a person can only understand meaningfully constructed sentences, a computer only understands programs that send meaningfully formulated commands to it. It is therefore important to adhere to the syntax of the respective programming language when programming.
- As a person, you have imagination. So you can decipher and understand sentences that are incorrect in structure. A computer is (still) unimaginative: In order to understand and execute a command, the code must be error-free, so the rules of the syntax must be observed. Otherwise the program does not work.
Some programs have names that do not make it clear at first glance what the program is. An example of this is the so-called firmware - you will find out what is behind it in the next article.