On 3/4/20 6:21 AM, Matt Wette wrote:
On 2/23/20 7:29 AM, Matt Wette wrote:
On 2/21/20 8:12 PM, Aleix Conchillo Flaqué wrote:
Hi,

does anyone know if there's any YAML parser for Guile? Haven't been able to
find any.

Thanks!

Aleix

Hi Aleix,

I don't know of a YAML parser for Guile, but if you look at my email posted 2/22 I have a Guile package called NYACC.  This includes a "FFI Helper" that can generate the Guile FFI code based on yaml.h from libyaml.   The API is going to be C-like but if you do some
work to paste something on the front you will have something, I think.


I have something working for reads.   Check github dot com / mwette / guile-libyaml

Download and run "guile demo1.scm".  Compare to demo1.yml.

Matt


I have updated this.   I now have a procedure read-yaml-file which will read a yaml file and convert to a scheme tree.

Matt

$ GUILE_LOAD_PATH= guile demo1.scm
(("doe" . "a deer, a female deer")
 ("ray" . "a drop of golden sun")
 ("pi" . "3.14159")
 ("xmas" . "true")
 ("french-hens" . "3")
 ("calling-birds"
  .
  #("huey" "dewey" "louie" "fred"))
 ("xmas-fifth-day"
  ("calling-birds" . "four")
  ("french-hens" . "3")
  ("golden-rings" . "5")
  ("partridges"
   ("count" . "1")
   ("location" . "a pear tree"))
  ("turtle-doves" . "two"))


from


$ cat demo1.yml
---
 doe: "a deer, a female deer"
 ray: "a drop of golden sun"
 pi: 3.14159
 xmas: true
 french-hens: 3
 calling-birds:
   - huey
   - dewey
   - louie
   - fred
 xmas-fifth-day:
   calling-birds: four
   french-hens: 3
   golden-rings: 5
   partridges:
     count: 1
     location: "a pear tree"
   turtle-doves: two



Reply via email to