Since YAML has a rather complicated syntax, is it possible to write a parser for YAML mainly using ANTLR4 ? I was looking for examples, that implement the YAML like indentation parsing and the detection of data types.
Is there an ANTLR4 grammar for YAML?
The YAML specification contains a BNF grammar. Bear in mind that according to this document, fully correct YAML is context-sensitive and not parseable by parser-generators, so your grammar will have to describe a context-free superset.
© 2022 - 2024 — McMap. All rights reserved.
Indent
|Dedent
tokens, so you have not to deal with whitespace in the parser. – DacyYAMLLexer.cpp
), all other parts of the parser use the standard facilities provided by ANTLR (input handling, parser grammar, listener interface). – Intellectualism