This project has a large antlr4 grammar built. Don't know if it'd be useful or not.
https://github.com/nielsbasjes/yauaa/tree/master/analyzer/src/main/antlr4/nl/basjes/parse/useragent/parser