7 ms·
FWIW, here's a repo of ANTLR grammars: https://github.com/antlr/grammars-v4 https://github.com/antlr/grammars-v4 Many of them are incomplete, but it gives a go
by difflens 4y ago
FWIW, here's a repo of ANTLR grammars: https://github.com/antlr/grammars-v4 https://github.com/antlr/grammars-v4
Many of them are incomplete, but it gives a good idea of how the grammar looks for ANTLR.
I used the ANTLR grammar for parsing CSS in DiffLens (https://github.com/marketplace/difflens https://github.com/marketplace/difflens). DiffLens uses the typescript compiler itself to parse TS and JS.
I've also used Roslyn to parse C# (and F#). I wonder if the ruby compiler itself exposes a parser.