0

I have written a parser using Python Ply library.
While doing tests with an input file I have noticed a strange behaviour : sometimes the input is correctly parsed with no error and sometimes, there are parsing errors (and the parser doesn't follow the same rules and consequently finds syntax errors).

How can this happen since the parser is supposed to be deterministic ? My grammar is clean (no conflict of any kind), and obviously my input is valid.

I am not asking for a debug (especially as the grammar is quite complex), I juste would like to understand how this is possible and what might be the cause in a general way.

2
  • Just to be absolutely clear, you run the exact same parser with the exact same grammar on the exact same input two times, and get different results? – user7043 Oct 7 '16 at 22:12
  • Yes. However I think I've found the cause of this. In my tokens definition I have to equivalent regex and it seems like the lexer is not giving priority to one of these in particular. Still investigating. – ibi0tux Oct 7 '16 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.