Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No body talks about SDLang (Simple Declarative Language) : https://sdlang.org/

An example :

```

    // This is a node with a single string value
    title "Hello, World"

    // Multiple values are supported, too
    bookmarks 12 15 188 1234

    // Nodes can have attributes
    author "Peter Parker" email="peter@example.org" active=true

    // Nodes can be arbitrarily nested
    contents {
    	section "First section" {
    		paragraph "This is the first paragraph"
    		paragraph "This is the second paragraph"
    	}
    }

    // Anonymous nodes are supported
    "This text is the value of an anonymous node!"

    // This makes things like matrix definitions very convenient
    matrix {
	1 0 0
	0 1 0
	0 0 1
    }
```


One thing I dislike about it at a glance is:

    author "Peter Parker" email="peter@example.org" active=true
This is like XML attributes, which I've always found annoying to deal with in programs. It doesn't really map to any native data structure in most (all?) programming languages, so you need a special class/struct which supports it.

Simply using something that maps directly to a hash map/object/associative array would be much better, IMHO.

Other than that, it looks like an interesting project.


Actually it is even a superset of XML, from the docs...

    SDL documents are made up of Tags. A Tag contains

    * a name (if not present, the name "content" is used)
    * a namespace (optional)
    * 0 or more values (optional)
    * 0 or more attributes (optional)
    * 0 or more children (optional)
So it's like an XML node, but the `0 or more values` means it has a list/array for a "body".


At least on the case of DLang implementation, uses a DOM api to access to the values. https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md


I don't get the matrix example. Why is it different from key 1 with multiple values 0, 0, and key 0 with values either 1, 0 or 0, 1?


SDL identifiers start with a letter or underscore, and a key must be a valid identifier.


Interesting. They don't seem to have a python implementation surprisingly.


I have not seen this before, thanks for sharing.


The fact is that is old. I discovered it, seeing the dub build (DLang build&depency tool) files that can use JSON or SDLang.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: