Re:Wc2: Investigates optimizing 'wc', the Unix word count pr...
by James_K on Thursday June 20, 2024 @04:27PM
(#40742994)
That isn't relevant in the ASCII example, and the UTF-8 one uses a 256×256 table.
Re:Wc2: Investigates optimizing 'wc', the Unix word count pr...
by samatman on Friday June 21, 2024 @01:04PM
(#40751528)
Half of all bytes are illegal ASCII though.
Re:Wc2: Investigates optimizing 'wc', the Unix word count pr...
by James_K on Friday June 21, 2024 @05:26PM
(#40754004)
And actually there isn't a state for illegal ASCII so it makes no sense to have a transition to/from it. And it still can never receive a 3 as input and use that transition.
Re:Wc2: Investigates optimizing 'wc', the Unix word count pr...
by teo_zero on Saturday June 22, 2024 @01:15AM
(#40756469)
For 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?
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.