<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Recursive_descent_parser</id>
	<title>Recursive descent parser - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Recursive_descent_parser"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Recursive_descent_parser&amp;action=history"/>
	<updated>2026-05-04T10:28:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Recursive_descent_parser&amp;diff=3219280&amp;oldid=prev</id>
		<title>imported&gt;Theki: /* Examples */</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Recursive_descent_parser&amp;diff=3219280&amp;oldid=prev"/>
		<updated>2025-08-27T16:00:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Examples&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Previous revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:00, 27 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l190&quot;&gt;Line 190:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 190:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[Spirit Parser Framework]] – a C++ recursive descent parser generator framework requiring no pre-compile step&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[Spirit Parser Framework]] – a C++ recursive descent parser generator framework requiring no pre-compile step&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[parboiled (Java)]] – a recursive descent [[Parsing expression grammar|PEG]] parsing library for [[Java (programming language)|Java]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[[parboiled (Java)]] – a recursive descent [[Parsing expression grammar|PEG]] parsing library for [[Java (programming language)|Java]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The C++ front-end of the [[Clang]] compiler contains a hand-written parser based on the recursive-descent parsing algorithm. &amp;lt;ref&amp;gt;How Clang handles the type / variable name ambiguity of C/C++&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;https://eli.thegreenplace.net/2012/07/05/how-clang-handles-the-type-variable-name-ambiguity-of-cc/&amp;lt;/ref&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==See also==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==See also==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Theki</name></author>
	</entry>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Recursive_descent_parser&amp;diff=47021&amp;oldid=prev</id>
		<title>imported&gt;Citation bot: Added publisher. | Use this bot. Report bugs. | Suggested by Dominic3203 | Category:Articles with example C code | #UCB_Category 151/199</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Recursive_descent_parser&amp;diff=47021&amp;oldid=prev"/>
		<updated>2024-10-25T12:39:42Z</updated>

		<summary type="html">&lt;p&gt;Added publisher. | &lt;a href=&quot;/wiki143/index.php?title=En:WP:UCB&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;En:WP:UCB (page does not exist)&quot;&gt;Use this bot&lt;/a&gt;. &lt;a href=&quot;/wiki143/index.php?title=En:WP:DBUG&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;En:WP:DBUG (page does not exist)&quot;&gt;Report bugs&lt;/a&gt;. | Suggested by Dominic3203 | &lt;a href=&quot;/wiki143/index.php?title=Category:Articles_with_example_C_code&quot; title=&quot;Category:Articles with example C code&quot;&gt;Category:Articles with example C code&lt;/a&gt; | #UCB_Category 151/199&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{short description|Algorithm}}&lt;br /&gt;
{{More footnotes|date=February 2009}}&lt;br /&gt;
&lt;br /&gt;
In [[computer science]], a &amp;#039;&amp;#039;&amp;#039;recursive descent parser&amp;#039;&amp;#039;&amp;#039; is a kind of [[top-down parsing|top-down parser]] built from a set of [[mutual recursion|mutually recursive]] procedures (or a non-recursive equivalent) where each such [[procedure (computer science)|procedure]] implements one of the [[Terminal and nonterminal symbols|nonterminals]] of the [[formal grammar|grammar]]. Thus the structure of the resulting program closely mirrors that of the grammar it recognizes.&amp;lt;ref&amp;gt;{{FOLDOC|Recursive+descent+parser}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite book | title=Recursive Programming Techniques | author=Burge, W.H. | year=1975 | publisher=Addison-Wesley Publishing Company | isbn=0-201-14450-6 | url-access=registration | url=https://archive.org/details/recursiveprogram0000burg }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;#039;&amp;#039;predictive parser&amp;#039;&amp;#039; is a recursive descent parser that does not require [[backtracking]].&amp;lt;ref name=&amp;quot;Watson2017&amp;quot;&amp;gt;{{cite book|last=Watson|first=Des|title=A Practical Approach to Compiler Construction|url=https://books.google.com/books?id=05B0DgAAQBAJ&amp;amp;q=%22predictive+parser%22|date=22 March 2017|publisher=Springer|isbn=978-3-319-52789-5}}&amp;lt;/ref&amp;gt;  Predictive parsing is possible only for the class of [[LL parser|LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;)]] grammars, which are the [[context-free grammar]]s for which there exists some positive integer &amp;#039;&amp;#039;k&amp;#039;&amp;#039; that allows a recursive descent parser to decide which production to use by examining only the next &amp;#039;&amp;#039;k&amp;#039;&amp;#039; tokens of input. The LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;) grammars therefore exclude all [[ambiguous grammar]]s, as well as all grammars that contain [[left recursion]].  Any context-free grammar can be transformed into an equivalent grammar that has no left recursion, but removal of left recursion does not always yield an LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;) grammar. A predictive parser runs in [[linear time]].&lt;br /&gt;
&lt;br /&gt;
Recursive descent with backtracking is a technique that determines which [[Production rule (formal languages)|production]] to use by trying each production in turn.  Recursive descent with backtracking is not limited to LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;) grammars, but is not guaranteed to terminate unless the grammar is LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;).  Even when they terminate, parsers that use recursive descent with backtracking may require [[exponential time]].&lt;br /&gt;
&lt;br /&gt;
Although predictive parsers are widely used, and are frequently chosen if writing a parser by hand, programmers often prefer to use a table-based parser produced by a [[parser generator]],{{Citation needed|date=February 2018}} either for an LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;) language or using an alternative parser, such as [[LALR parser|LALR]] or [[LR parser|LR]]. This is particularly the case if a grammar is not in [[LL parser|LL(&amp;#039;&amp;#039;k&amp;#039;&amp;#039;)]] form, as transforming the grammar to LL to make it suitable for predictive parsing is involved. Predictive parsers can also be automatically generated, using tools like [[ANTLR]].&lt;br /&gt;
&lt;br /&gt;
Predictive parsers can be depicted using transition diagrams for each non-terminal symbol where the edges between the initial and the final states are labelled by the symbols (terminals and non-terminals) of the right side of the production rule.&amp;lt;ref&amp;gt;{{cite book|last1=Aho|first1=Alfred V.|last2=Sethi|first2=Ravi|last3=Ullman|first3=Jeffrey|authorlink1=Alfred V. Aho|authorlink3=Jeffrey Ullman|title=Compilers: Principles, Techniques and Tools|url=https://archive.org/details/compilers00ahoa|url-access=limited|date=1986|publisher=Addison Wesley|page=[https://archive.org/details/compilers00ahoa/page/n193 183]|edition=first}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example parser==&lt;br /&gt;
The following [[Extended Backus–Naur Form|EBNF]]-like [[formal grammar|grammar]] (for [[Niklaus Wirth]]&amp;#039;s [[PL/0]] programming language, from &amp;#039;&amp;#039;[[Algorithms + Data Structures = Programs]]&amp;#039;&amp;#039;) is in [[LL parser|LL(1)]] form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ebnf&amp;quot;&amp;gt;&lt;br /&gt;
 program = block &amp;quot;.&amp;quot; .&lt;br /&gt;
 &lt;br /&gt;
 block =&lt;br /&gt;
     [&amp;quot;const&amp;quot; ident &amp;quot;=&amp;quot; number {&amp;quot;,&amp;quot; ident &amp;quot;=&amp;quot; number} &amp;quot;;&amp;quot;]&lt;br /&gt;
     [&amp;quot;var&amp;quot; ident {&amp;quot;,&amp;quot; ident} &amp;quot;;&amp;quot;]&lt;br /&gt;
     {&amp;quot;procedure&amp;quot; ident &amp;quot;;&amp;quot; block &amp;quot;;&amp;quot;} statement .&lt;br /&gt;
 &lt;br /&gt;
 statement =&lt;br /&gt;
     ident &amp;quot;:=&amp;quot; expression&lt;br /&gt;
     | &amp;quot;call&amp;quot; ident&lt;br /&gt;
     | &amp;quot;begin&amp;quot; statement {&amp;quot;;&amp;quot; statement } &amp;quot;end&amp;quot;&lt;br /&gt;
     | &amp;quot;if&amp;quot; condition &amp;quot;then&amp;quot; statement&lt;br /&gt;
     | &amp;quot;while&amp;quot; condition &amp;quot;do&amp;quot; statement .&lt;br /&gt;
 &lt;br /&gt;
 condition =&lt;br /&gt;
     &amp;quot;odd&amp;quot; expression&lt;br /&gt;
     | expression (&amp;quot;=&amp;quot;|&amp;quot;#&amp;quot;|&amp;quot;&amp;lt;&amp;quot;|&amp;quot;&amp;lt;=&amp;quot;|&amp;quot;&amp;gt;&amp;quot;|&amp;quot;&amp;gt;=&amp;quot;) expression .&lt;br /&gt;
 &lt;br /&gt;
 expression = [&amp;quot;+&amp;quot;|&amp;quot;-&amp;quot;] term {(&amp;quot;+&amp;quot;|&amp;quot;-&amp;quot;) term} .&lt;br /&gt;
 &lt;br /&gt;
 term = factor {(&amp;quot;*&amp;quot;|&amp;quot;/&amp;quot;) factor} .&lt;br /&gt;
 &lt;br /&gt;
 factor =&lt;br /&gt;
     ident&lt;br /&gt;
     | number&lt;br /&gt;
     | &amp;quot;(&amp;quot; expression &amp;quot;)&amp;quot; .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[terminal symbol|Terminals]] are expressed in quotes.  Each [[nonterminal symbol|nonterminal]] is defined by a rule in the grammar, except for &amp;#039;&amp;#039;ident&amp;#039;&amp;#039; and &amp;#039;&amp;#039;number&amp;#039;&amp;#039;, which are assumed to be implicitly defined.&lt;br /&gt;
&lt;br /&gt;
===C implementation===&lt;br /&gt;
&lt;br /&gt;
What follows is an implementation of a recursive descent parser for the above language in [[C (programming language)|C]]. The parser reads in source code, and exits with an error message if the code fails to parse, exiting silently if the code parses correctly.&lt;br /&gt;
&lt;br /&gt;
Notice how closely the predictive parser below mirrors the grammar above.  There is a procedure for each nonterminal in the grammar.  Parsing descends in a top-down manner until the final nonterminal has been processed.  The program fragment depends on a global variable, &amp;#039;&amp;#039;sym&amp;#039;&amp;#039;, which contains the current symbol from the input, and the function &amp;#039;&amp;#039;nextsym&amp;#039;&amp;#039;, which updates &amp;#039;&amp;#039;sym&amp;#039;&amp;#039; when called.&lt;br /&gt;
&lt;br /&gt;
The implementations of the functions &amp;#039;&amp;#039;nextsym&amp;#039;&amp;#039; and &amp;#039;&amp;#039;error&amp;#039;&amp;#039; are omitted for simplicity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
typedef enum {ident, number, lparen, rparen, times, slash, plus,&lt;br /&gt;
    minus, eql, neq, lss, leq, gtr, geq, callsym, beginsym, semicolon,&lt;br /&gt;
    endsym, ifsym, whilesym, becomes, thensym, dosym, constsym, comma,&lt;br /&gt;
    varsym, procsym, period, oddsym} Symbol;&lt;br /&gt;
&lt;br /&gt;
Symbol sym;&lt;br /&gt;
void nextsym(void);&lt;br /&gt;
void error(const char msg[]);&lt;br /&gt;
&lt;br /&gt;
int accept(Symbol s) {&lt;br /&gt;
    if (sym == s) {&lt;br /&gt;
        nextsym();&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int expect(Symbol s) {&lt;br /&gt;
    if (accept(s))&lt;br /&gt;
        return 1;&lt;br /&gt;
    error(&amp;quot;expect: unexpected symbol&amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void factor(void) {&lt;br /&gt;
    if (accept(ident)) {&lt;br /&gt;
        ;&lt;br /&gt;
    } else if (accept(number)) {&lt;br /&gt;
        ;&lt;br /&gt;
    } else if (accept(lparen)) {&lt;br /&gt;
        expression();&lt;br /&gt;
        expect(rparen);&lt;br /&gt;
    } else {&lt;br /&gt;
        error(&amp;quot;factor: syntax error&amp;quot;);&lt;br /&gt;
        nextsym();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void term(void) {&lt;br /&gt;
    factor();&lt;br /&gt;
    while (sym == times || sym == slash) {&lt;br /&gt;
        nextsym();&lt;br /&gt;
        factor();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void expression(void) {&lt;br /&gt;
    if (sym == plus || sym == minus)&lt;br /&gt;
        nextsym();&lt;br /&gt;
    term();&lt;br /&gt;
    while (sym == plus || sym == minus) {&lt;br /&gt;
        nextsym();&lt;br /&gt;
        term();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void condition(void) {&lt;br /&gt;
    if (accept(oddsym)) {&lt;br /&gt;
        expression();&lt;br /&gt;
    } else {&lt;br /&gt;
        expression();&lt;br /&gt;
        if (sym == eql || sym == neq || sym == lss || sym == leq || sym == gtr || sym == geq) {&lt;br /&gt;
            nextsym();&lt;br /&gt;
            expression();&lt;br /&gt;
        } else {&lt;br /&gt;
            error(&amp;quot;condition: invalid operator&amp;quot;);&lt;br /&gt;
            nextsym();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void statement(void) {&lt;br /&gt;
    if (accept(ident)) {&lt;br /&gt;
        expect(becomes);&lt;br /&gt;
        expression();&lt;br /&gt;
    } else if (accept(callsym)) {&lt;br /&gt;
        expect(ident);&lt;br /&gt;
    } else if (accept(beginsym)) {&lt;br /&gt;
        do {&lt;br /&gt;
            statement();&lt;br /&gt;
        } while (accept(semicolon));&lt;br /&gt;
        expect(endsym);&lt;br /&gt;
    } else if (accept(ifsym)) {&lt;br /&gt;
        condition();&lt;br /&gt;
        expect(thensym);&lt;br /&gt;
        statement();&lt;br /&gt;
    } else if (accept(whilesym)) {&lt;br /&gt;
        condition();&lt;br /&gt;
        expect(dosym);&lt;br /&gt;
        statement();&lt;br /&gt;
    } else {&lt;br /&gt;
        error(&amp;quot;statement: syntax error&amp;quot;);&lt;br /&gt;
        nextsym();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void block(void) {&lt;br /&gt;
    if (accept(constsym)) {&lt;br /&gt;
        do {&lt;br /&gt;
            expect(ident);&lt;br /&gt;
            expect(eql);&lt;br /&gt;
            expect(number);&lt;br /&gt;
        } while (accept(comma));&lt;br /&gt;
        expect(semicolon);&lt;br /&gt;
    }&lt;br /&gt;
    if (accept(varsym)) {&lt;br /&gt;
        do {&lt;br /&gt;
            expect(ident);&lt;br /&gt;
        } while (accept(comma));&lt;br /&gt;
        expect(semicolon);&lt;br /&gt;
    }&lt;br /&gt;
    while (accept(procsym)) {&lt;br /&gt;
        expect(ident);&lt;br /&gt;
        expect(semicolon);&lt;br /&gt;
        block();&lt;br /&gt;
        expect(semicolon);&lt;br /&gt;
    }&lt;br /&gt;
    statement();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void program(void) {&lt;br /&gt;
    nextsym();&lt;br /&gt;
    block();&lt;br /&gt;
    expect(period);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Some recursive descent parser generators:&lt;br /&gt;
*[[TMG (language)|TMG]] – an early compiler-compiler used in the 1960s and early 1970s&lt;br /&gt;
*[[JavaCC]]&lt;br /&gt;
*[[Coco/R]]&lt;br /&gt;
*[[ANTLR]]&lt;br /&gt;
*[[Spirit Parser Framework]] – a C++ recursive descent parser generator framework requiring no pre-compile step&lt;br /&gt;
*[[parboiled (Java)]] – a recursive descent [[Parsing expression grammar|PEG]] parsing library for [[Java (programming language)|Java]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Parser combinator]] – a higher-order function used in combinatory parsing, a method of factoring recursive descent parser designs&lt;br /&gt;
*[[Parsing expression grammar]] – another form representing recursive descent grammar&lt;br /&gt;
*[[Recursive ascent parser]]&lt;br /&gt;
*[[Tail recursive parser]] – a variant of the recursive descent parser&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
===General references===&lt;br /&gt;
* &amp;#039;&amp;#039;[[Compilers: Principles, Techniques, and Tools]]&amp;#039;&amp;#039;, first edition, Alfred V Aho, Ravi Sethi, and Jeffrey D Ullman, in particular Section 4.4.&lt;br /&gt;
* &amp;#039;&amp;#039;Modern Compiler Implementation in Java, Second Edition&amp;#039;&amp;#039;, Andrew Appel, 2002, {{ISBN|0-521-82060-X}}.&lt;br /&gt;
* &amp;#039;&amp;#039;Recursive Programming Techniques&amp;#039;&amp;#039;, W.H. Burge, 1975, {{ISBN|0-201-14450-6}}&lt;br /&gt;
* &amp;#039;&amp;#039;Crafting a Compiler with C&amp;#039;&amp;#039;, Charles N Fischer and Richard J LeBlanc, Jr, 1991, {{ISBN|0-8053-2166-7}}.&lt;br /&gt;
* &amp;#039;&amp;#039;Compiling with C# and Java&amp;#039;&amp;#039;, Pat Terry, 2005, {{ISBN|0-321-26360-X}}, 624&lt;br /&gt;
* &amp;#039;&amp;#039;Algorithms + Data Structures = Programs&amp;#039;&amp;#039;, Niklaus Wirth, 1975, {{ISBN|0-13-022418-9}}&lt;br /&gt;
* &amp;#039;&amp;#039;Compiler Construction&amp;#039;&amp;#039;, Niklaus Wirth, 1996, {{ISBN|0-201-40353-6}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://compilers.iecc.com/crenshaw/ Jack W. Crenshaw: &amp;#039;&amp;#039;Let&amp;#039;s Build A Compiler&amp;#039;&amp;#039; (1988-1995)], in [[Pascal (programming language)|Pascal]], with [[assembly language]] output, using a &amp;quot;keep it simple&amp;quot; approach&lt;br /&gt;
&lt;br /&gt;
{{Parsers}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Parsing algorithms]]&lt;br /&gt;
[[Category:Articles with example C code]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Citation bot</name></author>
	</entry>
</feed>