This is a declarative language draft.
It's free form, indentation doesn't mean anything to the parser.
You do two things with this language: importing declarations from other files, and defining "items", which can be anything.
Every item has a name. An item can be either:
- a nestable meta/data semi-structured tree
- a typed relation between existing items
- a reusable set of parameterized items
Informal syntax taste-of:
namespace prefix = "filename"
item name -> [ meta | data ]
item name -> relation type { slot1: item1, item2, ... ; slot2: item3; }
new relation { parameters } = ( items declarations )
Here is the meta/data syntax. In "meta" you'd put everything needed to determine
how to manipulate the data part. In "data" you'd put the
data to be manipulated.
my favorite site ->
[
[type|
website
[media|forum]
[topic|AI]
]
|
[name|AIDreams]
[members|foo bar geez]
[posts|
[
[number|1]
[by|foo]
|
Hi guys, blah blah...
]
]
]
In XML, the "meta" part would be the attributes of an element. XML is weaker here, since attributes are merely associative arrays. In M|D, attributes are trees themselves, allowing a perfect representation of information, even when the complexity reaches high levels. Moreover, being tree everywhere, the representation is consistent and easier to manipulate.
Now, here is the relation syntax. It looks a bit like CSS. First you put the name of the type of relation, then between curly braces, a list of items following their role in the relation. Several items can have the same role.
rain wets -> explanation {
fact: everyone is wet;
causes: it rains, nobody has an umbrella;
consequences: they'll catch a cold;
}
Now the last one, a bit more complicated. It's a bit like a function, but for items declaration. The idea is to freeze parts that are always the same in a pattern, and give this pattern a name.
dog of {animal, someone} = (
kind -> instance of concept { instance: animal; concept: dog, pet; }
ownership -> owns{owner:someone; owned:animal;}
)
me and Max -> dog of { someone: me; animal: Max; }
It's a way to create new relation types. A macro, sort of.
Again, it's just a draft.