unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: YAML parser?
Date: Tue, 24 Mar 2020 18:04:31 -0700	[thread overview]
Message-ID: <e428aa08-0737-39cc-a9ef-0d6c134eaf71@gmail.com> (raw)
In-Reply-To: <31f1d859-fedd-0ae9-8558-d80e38ba90b2@gmail.com>

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





  parent reply	other threads:[~2020-03-25  1:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22  4:12 YAML parser? Aleix Conchillo Flaqué
2020-02-23 15:29 ` Matt Wette
2020-02-24 14:35   ` Matt Wette
2020-03-04 14:21   ` Matt Wette
2020-03-06 19:49     ` Aleix Conchillo Flaqué
2020-03-25  1:04     ` Matt Wette [this message]
2020-03-25 23:02       ` Aleix Conchillo Flaqué
2020-02-24 14:48 ` Thompson, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e428aa08-0737-39cc-a9ef-0d6c134eaf71@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).