Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you can decide where to go from a current state based on the value on top of the stack, you use symbols on the stack to keep notes about the state of the parsing.</p> <p>here is how i think this would work: <strong>this</strong> are symbols read from the input, <strong>THIS</strong> are symbols on a stack. the symbol <strong>X</strong> on the botoom of the stack means that n &lt;= m do not confuse <strong>X</strong> with <strong>Z</strong>, which is the initial symbol of the stack and helps determine when the stack is empty.</p> <p>there are probably some problems with this solution, but it the overall approach should be correct.</p> <p>... and good luck with your test :-)</p> <hr> <p>first you read all the <strong>a</strong> symbols from the beginning of the string and add <strong>A</strong> to a stack for each of them, or push <strong>X</strong> if there was no <strong>a</strong></p> <p>then you read all the <strong>b</strong> symbols:</p> <ul> <li>if the stack is empty (<strong>Z</strong> is on top), <strong>B</strong> is on top or <strong>X</strong> is on top, then you push another <strong>B</strong> to the stack.</li> <li>if stack has <strong>A</strong> on top, then you remove it.</li> </ul> <p>the last step is to read the final <strong>a</strong> symbols.</p> <ul> <li>if there is <strong>B</strong> on the stack, remove it.</li> <li>if there is <strong>X</strong> on the stack, then keep it there</li> <li>if the stack is empty (<strong>Z</strong> on top), then this must be the end of the string</li> </ul> <hr> <p>another edit:</p> <p>sorry if the above isn't clear ... i'll try to formalize it.</p> <p>accepting states are (4) and (5), starting state is (1). and it's nondeterministic</p> <p>and the transition rules:</p> <p>state (1) : read the first batch of <strong>a</strong> symbols</p> <ul> <li>(1) <strong>a</strong>; <strong>Z</strong> / <strong>AZ</strong> -> (1)</li> <li>(1) <strong>a</strong>; <strong>A</strong> / <strong>AA</strong> -> (1)</li> <li>(1) epsilon; <strong>A</strong> / <strong>A</strong> -> (2)</li> <li>(1) epsilon; <strong>Z</strong> / <strong>Z</strong> -> (2)</li> </ul> <p>state (2) : read <strong>b</strong> symbols</p> <ul> <li>(2) <strong>b</strong>; <strong>Z</strong> / <strong>BZ</strong> -> (2)</li> <li>(2) <strong>b</strong>; <strong>X</strong> / <strong>BX</strong> -> (2)</li> <li>(2) <strong>b</strong>; <strong>B</strong> / <strong>BB</strong> -> (2)</li> <li>(2) <strong>b</strong>; <strong>A</strong> / epsilon -> (2)</li> <li>(2) epsilon; <strong>B</strong> / <strong>B</strong> -> (3)</li> <li>(2) epsilon; <strong>X</strong> / <strong>X</strong> -> (3)</li> <li>(2) epsilon; <strong>Z</strong> / <strong>Z</strong> -> (3)</li> </ul> <p>state (3) : read the last <strong>a</strong>s</p> <ul> <li>(3) <strong>a</strong>; <strong>B</strong> / nothing -> (3)</li> <li>(3) epsilon; <strong>X</strong> / <strong>X</strong> -> (4)</li> <li>(3) epsilon; <strong>Z</strong> / <strong>Z</strong> -> (5)</li> </ul> <p>state (4) : the trailing <strong>a</strong>s if m > n</p> <ul> <li>(4) <strong>a</strong>; <strong>X</strong> / <strong>X</strong> -> (4)</li> </ul> <p>state (5) is for accepting the exact string when m &lt; n</p> <p>(and just to be absolutely clear -- when there is no way of a state and the reading cursor is not at the end of the word, then the word is not accepted)</p> <p>This could maybe be made a bit simpler by using adidional states instead of the stack symbol <strong>X</strong>, but i guess you can do it yourself :-)</p>
    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. 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