0

I'm looking for grammar files of the OCaml language written in ANTLR4 or JFlex.

If they already exist somewhere, where I can find them? Else, how can I generate or write one of them by myself?

Nathan Fallet
  • 321
  • 2
  • 16
  • 1
    I don't think there's an Antlr4 grammar. Looks like you'll have to scrape https://askra.de/software/ocaml-doc/4.02/full-grammar.html or better https://ocaml.org/manual/language.html. If there was a BNF, Trash or BNFC might be able to convert it to Antlr4. Otherwise, you could scrape it from the source, https://github.com/ocaml/ocaml/tree/trunk/parsing. – kaby76 Apr 14 '21 at 17:13
  • The biggest grammars repository is located here: https://github.com/antlr/grammars-v4 You can search there or request for a new grammar, maybe somebody will implement it someday. – Ivan Kochurkin Apr 27 '21 at 14:27
  • There is also an SDF3 specification for OCaml grammar, for what it worths https://eelcovisser.org/talks/2020/08/28/ocaml/ – ivg Apr 28 '21 at 14:20

0 Answers0