Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Examples from wikipedia</p> <h2><a href="http://en.wikipedia.org/wiki/LL_parser#Concrete_example">LL(1)</a></h2> <p><strong>grammar</strong></p> <pre><code>S -&gt; F S -&gt; ( S + F ) F -&gt; a </code></pre> <p><strong>input</strong></p> <pre><code>( a + a ) </code></pre> <p><strong>parsing steps</strong></p> <pre><code>S -&gt; "(" S "+" F ")" -&gt; ( "F" + F ) -&gt; ( "a" + F ) -&gt; ( a + "a" ) </code></pre> <h2><a href="http://en.wikipedia.org/wiki/LR_parser#Concrete_example">LR(0)</a></h2> <p><strong>grammar</strong></p> <pre><code>(1) E → E * B (2) E → E + B (3) E → B (4) B → 0 (5) B → 1 </code></pre> <p><strong>input</strong></p> <pre><code>1 + 1 </code></pre> <p><strong>parsing steps</strong></p> <pre><code>need to build a parser table and traverse through states. </code></pre> <h2><a href="http://en.wikipedia.org/wiki/Canonical_LR_parser">LR(1)</a></h2> <p><strong>grammar</strong></p> <pre><code>S’ -&gt; S S S -&gt; C C C -&gt; c C | d </code></pre> <p><strong>input</strong></p> <pre><code>cd </code></pre> <p><strong>parsing steps</strong></p> <pre><code>large table </code></pre> <h2><a href="https://www.l2f.inesc-id.pt/~david/wiki/pt/index.php/Bottom-Up_Parsing/LALR%281%29_Example_1">LALR</a></h2> <p><strong>grammar</strong></p> <pre><code>A -&gt; C x A | ε B -&gt; x C y | x C C -&gt; x B x | z </code></pre> <p><strong>input</strong></p> <pre><code>xxzxx </code></pre> <p><strong>parsing steps</strong></p> <pre><code>traverse large parser table </code></pre> <p>You may also want to have a look at </p> <ul> <li><a href="http://www.supereasyfree.com/software/simulators/compilers/principles-techniques-and-tools/parsing-simulator/parsing-simulator.php">Parsing Simulator tool</a></li> <li><a href="http://www.antlr.org/works/index.html">antlr works</a> - <a href="http://www.antlr.org/download/antlrworks-1.4.2.jar">>download&lt;</a></li> <li><a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-035-computer-language-engineering-spring-2010/lecture-notes/MIT6_035S10_lec03b.pdf">Parser table generation from ocw mit</a> </li> <li><a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-035-computer-language-engineering-sma-5502-fall-2005/lecture-notes/14_wrapup.pdf">From parsing to code genration ocw mit</a></li> <li><a href="http://www.scribd.com/doc/17338168/ParsersLRLALRLSLR">additional examples</a> </li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload