language-icon Old Web
English
Sign In

Left recursion

In the formal language theory of computer science, left recursion is a special case of recursion where a string is recognized as part of a language by the fact that it decomposes into a string from that same language (on the left) and a suffix (on the right). For instance, 1 + 2 + 3 {displaystyle 1+2+3} can be recognized as a sum because it can be broken into 1 + 2 {displaystyle 1+2} , also a sum, and + 3 {displaystyle {}+3} , a suitable suffix. In the formal language theory of computer science, left recursion is a special case of recursion where a string is recognized as part of a language by the fact that it decomposes into a string from that same language (on the left) and a suffix (on the right). For instance, 1 + 2 + 3 {displaystyle 1+2+3} can be recognized as a sum because it can be broken into 1 + 2 {displaystyle 1+2} , also a sum, and + 3 {displaystyle {}+3} , a suitable suffix. In terms of context-free grammar, a nonterminal is left-recursive if the leftmost symbol in one of its productions is itself (in the case of direct left recursion) or can be made itself by some sequence of substitutions (in the case of indirect left recursion). A grammar is left-recursive if and only if there exists a nonterminal symbol A {displaystyle A} that can derive to a sentential form with itself as the leftmost symbol. Symbolically, where ⇒ + {displaystyle Rightarrow ^{+}} indicates the operation of making one or more substitutions, and α {displaystyle alpha } is any sequence of terminal and nonterminal symbols.

[ "Mutual recursion" ]
Parent Topic
Child Topic
    No Parent Topic