11

When trying to use a generated grammar and lexer I get:

org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 2 (expected 3).

What's wrong?

Alex Shesterov
  • 26,085
  • 12
  • 82
  • 103

1 Answers1

8

Your parser was generated with ANTLR 4.0, but you are trying to execute it with ANTLR 4.1. The most likely cause of this is using ANTLRWorks 2.0 to generate the parser, which internally uses ANTLR 4.0. I'm in the process of releasing ANTLRWorks 2.1 which will correct this mismatch.

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
  • This can be way more complicated than that with some transient dependency resolved that way that one have slightly different ANTLR version in the final build – shabunc Nov 21 '22 at 14:23