Formal Language
A formal language is defined by two components: -Alphabet -Rules of syntax
Formal Language ‘Alphabet’ The alphabet is a precisely defined as a finite set. Elements of the set are called, ‘symbols’. (Similar to words in natural language)
Formal Language ‘Rules of syntax’ This defines how to construct ‘strings’ of the language out of ‘symbols’ (Equivalent of sentences in a natural language)
Formal Language Example: pencil notation Alphabet {H, B, 1, 2, 3, 4} (Equivalent of sentences in a natural language) Strings {“4B”, “3B”, “2B”, “B”, “HB”, “4H”, “3H”, “2H”, “H”} (Note, the above are strings not symbols, strings are in double quotes) It is not usual to be able to list all the strings in a language. Therefore, there needs to be someway of describing the ‘rules’ that are linked to the language.
Formal Language Example: pencil notation Alphabet {H, B, 1, 2, 3, 4} (Equivalent of sentences in a natural language) Strings {“4B”, “3B”, “2B”, “B”, “HB”, “4H”, “3H”, “2H”, “H”} (Note, the above are strings not symbols, strings are in double quotes) It is not usual to be able to list all the strings in a language. Therefore, there needs to be someway of describing the ‘rules’ that are linked to the language.