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.

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

2 - 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.

constructs common to many languages

  • functions,
  • arrays,
  • dictionaries,
  • regular expressions
code/grammar/grammar.txt · Last modified: 2017/09/17 18:22 by gerardnico