3 ms·
No body talks about SDLang (Simple Declarative Language) : https://sdlang.org/ https://sdlang.org/ An example : ``` // This is a node with a single strin
by Zardoz84 8y ago
No body talks about SDLang (Simple Declarative Language) : https://sdlang.org/ 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
}
```
- arp242 8y agoOne 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.
- transfire 8y agoActually 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".
- Zardoz84 8y agoAt 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 https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md
- urda 8y agoI have not seen this before, thanks for sharing.
- Zardoz84 8y agoThe fact is that is old. I discovered it, seeing the dub build (DLang build&depency tool) files that can use JSON or SDLang.
- carlsborg 8y agoInteresting. They don't seem to have a python implementation surprisingly.
- viraptor 8y agoI 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?
- skymt 8y agoSDL identifiers start with a letter or underscore, and a key must be a valid identifier.