As an alternative to BNF, there’s PEG support in Prolog: GitHub - ridgeworks/pPEGpl: pPEG grammar support for SWI-Prolog
Is that GitHub - chrusty/protoc-gen-jsonschema: Protobuf to JSON-Schema compiler or GitHub - GoogleCloudPlatform/protoc-gen-bq-schema: protoc-gen-bq-schema helps you to send your Protocol Buffer messages to BigQuery. ?
Yes – and it turns out to be surprisingly messy to annotate an AST with source coordinates (it’s also surprisingly messy to produce good error messages). I think that using edcg instead of DCG can be helpful, although there are ways of threading multiple (and custom) accumulators with regular DCGs. Or, there’s this: Dealing with state - #10 by jan