nickovic / rtamt

Specification-based real-time monitoring library
BSD 3-Clause "New" or "Revised" License
50 stars 20 forks source link

Update ANTLR version #145

Closed iporres closed 2 years ago

iporres commented 2 years ago

Can rtamt use a new version of the antrl runtime library?

There seems to be a problem with older versions of antlr4-python3-runtime and new versions of Pyhton. See https://stackoverflow.com/questions/46079258/cant-import-module-antlr-mygrammarlexer-and-mygrammarparser/65054963

It is solved if you use antlr4-python3-runtime==4.9 instead of antlr4-python3-runtime==4.5

cirrostratus1 commented 2 years ago

The version also interferes with other tools like hydra that also use antlr.

nickovic commented 2 years ago

The reason that we use antlr4-python3-runtime>=4.5, <4.6 in setup.py is that the parser is generated using ANTLR 4.5. If we force install the version 4.9, we get warnings "ANTLR runtime and generated code versions disagree: 4.9.3!=4.5.1".

Moreover I do not see it as a robust solution, because some other applications may require other versions of ANTLR-runtime (the version 4.10 is out and does not see to be backwards compatible). Unless there is a good argument against, I would prefer to keep the version 4.5 as the default for now.

cirrostratus1 commented 2 years ago

Is there any information regarding compatibility for antlr runtime and generated versions (I was unable to find a compatibility matrix)? If there were a more recent version that the generated version could be updated to (4.6 is from 2016) and that is compatible with multiple versions, at least some dependency conflicts with recent tools could be avoided.

nickovic commented 2 years ago

I could not find any compatibility information, but by trying different version, everything between v4.5 and 4.9 included seems to work, and 4.10 does not seem to be backwards compatible.

nickovic commented 2 years ago

As a compromise, I recompiled the parser and the lexer with ANTLR4 v4.7 (the default version in Ubuntu 18.04 LTS) and updated the setup.py accordingly. However, if one uses in the same flow two applications with ANTLR4 grammars compiled with different versions of ANTLR4, I do not see how to avoid the warning messages.