I have been using the Listings package for C and Java highlighting and I also need to highlight my Antlr4 grammar code, which is of the .g4 format. Are there any existing setups for this, preferably in the Listings package, or otherwise?

  • Excuse me. But your question is related with LaTeX? – Sebastiano May 3 at 11:52
  • Great question, I was searching for this myself, but could not yet find a nice listingstyle – user188004 May 3 at 12:04
  • Sebastiano it is for latex environment the highlighting is needed. Ill edit the title for better explanation – tralala May 4 at 18:47
  • Its just EBNF, but the files in antlr4 (.g4), have some additional syntax besides regular EBNF, so thats why I called it antlr4 grammar, though it's maybe not correct to call it a grammar. I was unsure what to call it? Its EBNF and then there are some additional elements added, like labels using #, for when antlr generates visitor methods. There are certain characters to escape. Non-terminals have to be small letters and terminals have to be all caps. – tralala May 6 at 5:50

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.