How to Write a Program

Anthony C. Hay

25 October 2014

Introducing Loon

I wanted a simple way to read and write program configuration and some state data. The configuration needed to be human readable and it would simplify problem diagnosis if the state data was also human readable. In the past I've sometimes used XML for these tasks. This time I wanted to do something different, so I made Loon and wrote a Loon reader/writer in C++.

Loon looks like this


; a Loon dictionary containing one entry called Image

(dict
    "Image" (dict
        "Width"  800
        "Height" 600
        "Title"  "View from 15th Floor"
        "Thumbnail" (dict
            "Url"    "http://www.example.com/image/481989943"
            "Width"  125
            "Height" 100
        )
        "IDs" (arry 116 943 234 38793)
    )
)

; the value of the Image key is a dictionary whose Thumbnail key is another
; dictionary and whose IDs key is an array of numbers



; a Loon array containing two dictionaries

(arry
    (dict
        "Latitude"   51.427959
        "Longitude"  -1.8569018
        "Address"    "Avebury"
        "City"       ""
        "County"     "Wiltshire"
        "Post Code"  "SN8 1RF"
        "Country"    "GB"
    )
    (dict
        "Latitude"   51.176197
        "Longitude"  -1.8377299
        "Address"    "Stonehenge"
        "City"       ""
        "County"     "Wiltshire"
        "Post Code"  "SP4 7DE"
        "Country"    "GB"
    )
)

index of blog posts