Code - Grammar / Syntax (Lexical)

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.

Grammars are useful models when designing software that processes data with a recursive structure.

To see how a grammar is defined to be able to parse it in a compiler. See Language - (Grammar | Syntax | Lexicon)

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 lexicon (The input file of the lexer)

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.

The syntax describing the form (the structure) has to be contrasted with the semantics (the meaning). See Code - Semantic (Meaning|Behaviour)

Structure / Building Block / Construct

Programs are just collections of statements. A statement are made up of one or more token that performs a specific task. This statement tokens made one or more expressions.

The following expressions are the basis building block of any language:

The definition on how you write of all this building block is called a grammar.

Others constructs common to many languages

Task Runner