Code - Grammar (Lexical)
1 - About
This section regroups the entity of a computer language from a lexical point of view. It's the same as Parts of the speech for a natural language. To see how a grammar is defined to be able to parse it in a compiler. See Language - Formal (Grammar|Syntax|Structure)
Every language displays a structure called its grammar or syntax.
The Grammar is also known as:
- Formal Grammar (formal meaning with structure)
- The Syntax
- The Language structure
The syntax of a computer language is the set of rules that defines the combinations of symbols (text or visual) that are considered to be a correctly structured document or fragment in that language.
A syntax does not only define the set of sentences of a language, but also provides them with a structure.
2 - Structure / Building Block / Construct
The following expressions are the basis building block of any language:
- conditionals flow like if statements to make decisions.
- loops to repeat tasks until a condition stops being true.
- operators to perform basic known operation on value.
- comment to document the code.
The definition on how you write of all this building block is called a grammar.
constructs common to many languages
- regular expressions