3 ms·
> But I'm not sure why the table is 4×4. The fourth transition from every state is unreachable since the symbols are all in [0, 2]. I think the fourth transiti
by samatman 2y ago
> But I'm not sure why the table is 4×4. The fourth transition from every state is unreachable since the symbols are all in [0, 2].
I think the fourth transition represents illegal Unicode. From there it stays in the illegal state until it hits legal UTF-8, then goes back to counting.
- James_K 2y agoThat isn't relevant in the ASCII example, and the UTF-8 one uses a 256×256 table.
- teo_zero 2y agoFor handling ASCII, table needs 4 states × 3 classes of chars. Why is it defined as 4×4? To handle illegal chars, it would need a 4th class but also a 5th state, so that's not the reason. Can it be to replace a 'modulo' operation with an 'and' in the access to table?