Skip to content
pannous edited this page Sep 14, 2021 · 28 revisions

Angle usually uses the wasp data format:

person{name="Joe"}
person{name:"Joe" number:12345 address:{street=…}}

Everything is a node internally. Nodes have internal primitive types: {} objects, [] patterns and () groups Denoted by different braces: {} [] () In data, without evaluation these groupings are similar: {1 2 3} [1 2 3] (1 2 3) all denote a list with 3 elements. {a:1 b:2 c:3} [a:1 b:2 c:3] (a:1 b:2 c:3) all denote a map with 3 elements.

However upon evaluation, compilation and interpretation they can have different semantics. {} is the most ambitious of those three groupings:

block, code and closure denoted by {} are very similar concepts:

Significant colon

There is a subtle difference between
person{name:"Joe" address{street:"no way 123"}}
person:{name="Joe" address:{street="no way 123"}}

While both construct an object person, the variant with colon constructs pure data while the variant without colon constructs the person via a constructor, if available.

So if previously type person is defined like a person has a random id then Joe will automatically derive that id if constructed as person{name:"Joe"}. The pure data built with person:{name="Joe"} only has a soft-type of person, an elusive unenforced type hint.

Apart from the above canonical format, Angle can also consume lisp/mark/polish-notation style data:
(person (name Joe))

Since these formats have different semantics, the lisp style needs a special keyword to activate the slightly modified parser.

Another slightly different format called kdl treats each line as a node instead of list:

html lang="en" {
    head {
        meta charset="utf-8"
        meta name="viewport" content="width=device-width, initial-scale=1.0"
        meta \
            name="description" \
            content="kdl is a document language, mostly based on SDLang, with xml-like semantics"
        title "kdl - Kat's Document Language"
        link rel="stylesheet" href="/styles/global.css"
    }
    body {
        main {
            h1 class="text-4xl text-center" "kdl - Kat's Document Language"
            section class="kdl-section" id="description" {
                p {
                    - "kdl is a document language, mostly based on "
                    a href="https://sdlang.org" "SDLang"
                    - " with xml-like semantics that looks like you're invoking a bunch of CLI commands"
                }
                p "It's meant to be used both as a serialization format and a configuration language, and is light compared to XML."
            }
        }
    }
}

To illustrate the difference, mutable x=7 is parsed as (mutable x)=7 in wasp and mutable[x=7] in kdl. The only thing I don't like in kdl are

  • string values need to be quoted
  • the - for text nodes without name/identifier/key. The (false) reason is that quotes at the beginning of nodes denote complex identifiers: person "home address":berlin This is fine, but the distinguishing syntax role should be: if a quoted node is empty it is a text node

With that rule both formats are nearly compatible and the remaining difference can be put behind a parser directive or flag. It is really just a question of whether 'space binds stronger than =' as in wasp or not as in kdl.

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally