background preloader

Formal language - Grammar

Facebook Twitter

Formal language theory. Structure of a syntactically well-formed, although nonsensical English sentence (historical example from Chomsky 1957).

Formal language theory

History[edit] The first formal language is thought be the one used by Gottlob Frege in his Begriffsschrift (1879), literally meaning "concept writing", and which Frege described as a "formal language of pure thought. "[2] Axel Thue's early Semi-Thue system which can be used for rewriting strings was influential on formal grammars.

Words over an alphabet[edit] In some applications, especially in logic, the alphabet is also known as the vocabulary and words are known as formulas or sentences; this breaks the letter/word metaphor and replaces it by a word/sentence metaphor. Formal grammar. A formal grammar is a set of rules for rewriting strings, along with a "start symbol" from which rewriting starts.

Formal grammar

Therefore, a grammar is usually thought of as a language generator. However, it can also sometimes be used as the basis for a "recognizer"—a function in computing that determines whether a given string belongs to the language or is grammatically incorrect. To describe such recognizers, formal language theory uses separate formalisms, known as automata theory. One of the interesting results of automata theory is that it is not possible to design a recognizer for certain formal languages. Parsing is the process of recognizing an utterance (a string in natural languages) by breaking it down to a set of symbols and analyzing each one against the grammar of the language. Introductory example[edit] For example, assume the alphabet consists of a and b, the start symbol is S, and we have the following production rules: then we start with S, and can choose a rule to apply to it. .

Automata theory. An example of an automaton. The study of the mathematical properties of such automata is automata theory. Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science, under Discrete mathematics (a section of Mathematics and also of Computer Science). Automata comes from the Greek word αὐτόματα meaning "self-acting". Automata theory is also closely related to formal language theory. Automata play a major role in theory of computation, compiler design, artificial intelligence, parsing and formal verification. Automata[edit] Following is an introductory definition of one type of automaton, which attempts to help one grasp the essential concepts involved in automata theory(s).

Informal description[edit] In short, an automaton is a mathematical object that takes a word as input and decides either to accept it or reject it. Formal definition[edit] Automaton Input word Run Input States. Context-free grammar. V → w where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals (w can be empty).

Context-free grammar

A formal grammar is considered "context free" when its production rules can be applied regardless of the context of a nonterminal. No matter which symbols surround it, the single nonterminal on the left hand side can always be replaced by the right hand side. Context-free grammars arise in linguistics where they are used to describe the structure of sentences and words in natural language, and they were in fact invented by the Linguist Noam Chomsky for this purpose, but have not really lived up to their original expectation. By contrast, in computer science, as the use of recursively defined concepts increased, they were used more and more. In linguistics, some authors use the term phrase structure grammar to refer to context-free grammars, whereby phrase structure grammars are distinct from dependency grammars. Background[edit] can be logically parenthesized as follows: where.

Backus–Naur Form. In computer science, BNF (Backus Normal Form or Backus–Naur Form) is one of the two[1] main notation techniques for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats, instruction sets and communication protocols; the other main technique for writing context-free grammars is the van Wijngaarden form.

Backus–Naur Form

They are applied wherever exact descriptions of languages are needed: for instance, in official language specifications, in manuals, and in textbooks on programming language theory. Many extensions and variants of the original Backus–Naur notation are used; some are exactly defined, including Extended Backus–Naur Form (EBNF) and Augmented Backus–Naur Form (ABNF). History[edit] The idea of describing the structure of language with rewriting rules can be traced back to at least the work of Pāṇini (about the 4th century BC), who used it in his description of Sanskrit word structure.

Formal system. Formal systems in mathematics consist of the following elements: A formal system is said to be recursive (i.e. effective) if the set of axioms and the set of inference rules are decidable sets or semidecidable sets, according to context.

Formal system

Some theorists use the term formalism as a rough synonym for formal system, but the term is also used to refer to a particular style of notation, for example, Paul Dirac's bra–ket notation.