Analizzatore lessicale: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m Bot: piccoli errori di battitura |
m sostituzione html della tabella con wikicodice |
||
Riga 27:
Ci aspetteremo che l'output sia formato dai seguenti tokens:
{|
! Tipo token
|-
| numero
| 123
|-
| operatore
| +
|-
| numero
| 141
|-
| operatore
| /
|-
| numero
| 725
|}
Da notare come gli spazi bianchi vengano saltati.
Riga 47 ⟶ 58:
Nel caso del nostro esempio, <code>123 + 141 / 725</code>, gli spostamenti tra gli stati sarebbero stati i seguenti:
! Carattere
! Stato Attuale
! Azione
|-
| 1
| 1
<tr><td>+</td><td>3</td><td>Produci token di tipo Numero e valore 123</td></tr>▼
|-
<tr><td>+</td><td>2</td><td>Produci token di tipo Operatore e valore +</td></tr>▼
| 2
| 2
|-
| 3
<tr><td>/</td><td>3</td><td>Produci token di tipo Numero e valore 141</td></tr>▼
| 2
| Vai a stato (2)
|-
| +
| 2
| Vai a stato (3)
|-
| +
| 3
|-
| +
| 1
| Vai a stato (4)
|-
| +
| 2
|-
| 1
| 1
| Vai a stato (2)
|-
| 4
| 2
| Vai a stato (2)
|-
| 1
| 2
| Vai a stato (2)
|-
| /
| 2
| Vai a stato (3)
|-
| /
| 3
|}
e cosi via...
| |||