haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
297 stars 82 forks source link

Fixed crash in issue 71 #152

Closed andreasabel closed 4 years ago

andreasabel commented 4 years ago

[ #71 ] Fixed crash in DFAMin

DFA minimization used to crash on tokens of the form c* which produce automata with only accepting states. Considering the empty set of non-accepting states as an equivalence class caused minimization to crash with exception

Prelude.head: empty list

Now, DFA minimization succeeds.

There is still a problem with nullable tokens like c*. Alex produces an infinite token sequence at the end of the input.

simonmar commented 4 years ago

I'm not really a fan of all the local definitions of head. Doesn't profiling work to debug head [] when it happens?

(but thanks for diagnosing and fixing the bug!)

andreasabel commented 4 years ago

I'm not really a fan of all the local definitions of head.

Ok, understood. I deleted the patch that does the local head definitions. I also rebased this PR onto the latest master.

Doesn't profiling work to debug head [] when it happens?

I am yet lacking profiling skills, I am afraid.

simonmar commented 4 years ago

Thanks!