README.md
1# YAML support for SWI-Prolog
2
3This package provides a SWI-Prolog wrapper around
4[libyaml](https://github.com/yaml/libyaml), a popular C-based YAML
5parser that is used by several languages.
6
7An obvious option to support YAML support is to write it all in Prolog,
8as done by a another [YAML add
9on](http://www.swi-prolog.org/pack/list?p=yaml). The YAML spec however
10is rather complicated and several versions of YAML have been defined.
11This makes it attractive to reuse a widespread library that provides a
12YAML parser that is guaranteed to be compatible with YAML support of
13several other languages, dispite the fact that the wrapper is probably
14not much longer than a Prolog parser.
15
16The generated data structure is compatible with SWI-Prolog's JSON
17libraries as long a no explicit non-standard YAML tags (e.g., `!!mytype
18value` are used. Documents may be converted between JSON and YAML by
19reading using json_read_dict/2 and writing using yaml_write/2 or reading
20using yaml_read/2 and writing using json_write_dict/2 as long as the
21YAML can be expressed in JSON.
22