author | Claudio Luck <claudio.luck@pep.foundation> |
Thu, 19 Mar 2020 14:54:23 +0100 | |
changeset 61 | 482106d33bf6 |
parent 56 | d48cf08cf448 |
permissions | -rw-r--r-- |
56
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
1 |
## What is YML? |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
2 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
3 |
Well, it's the idea not to need to define a grammar first when you want to use a Domain Specific Language. For that purpose, YML is being translated into XML. Let's make an example. |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
4 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
5 |
Everything which comes close to a C like language, parses without a grammar definition: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
6 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
7 |
This: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
8 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
9 |
template< class T > T max(T a, T b); |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
10 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
11 |
Parses to: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
12 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
13 |
<?xml version='1.0' encoding='UTF-8'?> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
14 |
<template> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
15 |
<generic> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
16 |
<class/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
17 |
<T/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
18 |
</generic> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
19 |
<T> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
20 |
<max> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
21 |
<parm> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
22 |
<T/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
23 |
<a/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
24 |
</parm> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
25 |
<parm> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
26 |
<T/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
27 |
<b/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
28 |
</parm> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
29 |
</max> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
30 |
</T> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
31 |
</template> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
32 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
33 |
Instead of defining grammars, you test out and play around until the results are matching your needs. If the resulting tree does not fit what you're expecting, change it by patching the grammar with `decl`: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
34 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
35 |
This: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
36 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
37 |
module A { |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
38 |
interface B { |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
39 |
attribute long n; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
40 |
}; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
41 |
}; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
42 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
43 |
Parses to: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
44 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
45 |
<?xml version='1.0' encoding='UTF-8'?> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
46 |
<module> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
47 |
<A> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
48 |
<interface> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
49 |
<B> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
50 |
<attribute> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
51 |
<long> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
52 |
<n/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
53 |
</long> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
54 |
</attribute> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
55 |
</B> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
56 |
</interface> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
57 |
</A> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
58 |
</module> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
59 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
60 |
This does not look like what we want. So we tell YML that we have a module name after the module, an interface name after the interface and type and name after the attribute: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
61 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
62 |
This: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
63 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
64 |
decl module @name; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
65 |
decl interface @name; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
66 |
decl attribute @type @name; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
67 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
68 |
module A { |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
69 |
interface B { |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
70 |
attribute long n; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
71 |
}; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
72 |
}; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
73 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
74 |
Parses to: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
75 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
76 |
<?xml version='1.0' encoding='UTF-8'?> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
77 |
<module name="A"> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
78 |
<interface name="B"> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
79 |
<attribute type="long" name="n"/> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
80 |
</interface> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
81 |
</module> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
82 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
83 |
What can I do with YML? |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
84 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
85 |
With YML you can: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
86 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
87 |
* use a C-like DSL without writing a grammar first |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
88 |
* generate code out of this DSL using YSLT |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
89 |
* generate code out of UML using YSLT on XMI |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
90 |
* generate code out of any XML based language like SVG using YSLT |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
91 |
* define a wiki like language in just a few lines like YHTML does |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
92 |
* replace bad designed and complicated XML languages with simpler C-like ones |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
93 |
* ... and much more. |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
94 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
95 |
How it works: Replacing angle brackets with some Python |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
96 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
97 |
Just writing down what I wanted to have instead of XML for a sample: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
98 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
99 |
<list name="List of goods"> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
100 |
<head> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
101 |
<columTitle> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
102 |
Goods |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
103 |
</columnTitle> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
104 |
<columnTitle> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
105 |
Price |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
106 |
</columnTitle> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
107 |
</head> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
108 |
<row> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
109 |
<value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
110 |
Beer |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
111 |
</value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
112 |
<value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
113 |
20 |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
114 |
</value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
115 |
</row> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
116 |
<row> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
117 |
<value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
118 |
Wine |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
119 |
</value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
120 |
<value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
121 |
30 |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
122 |
</value> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
123 |
</row> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
124 |
</list> |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
125 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
126 |
Something like that should be more easy, say, like this: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
127 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
128 |
list "List of goods" { |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
129 |
head title "Goods", title "Price"; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
130 |
row value "Beer", value 20; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
131 |
row value "Wine", value 30; |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
132 |
} |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
133 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
134 |
### Y Languages |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
135 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
136 |
The latter is what I call an Y language – a language specified in YML. How could this be achieved? Well, what's to do? To have the required information, how to build XML from the script above, we need: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
137 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
138 |
* the information, that “list of goods” is an attribute named `name`, while `Goods` is the text value of a tag |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
139 |
* `title` shout be written out as `columnTitle` |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
140 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
141 |
How to do that? Let's invent a simple definition language for that information: |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
142 |
|
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
143 |
decl list(name); |
d48cf08cf448
wip: add setup.py, README.md and debian packaging
Claudio Luck <claudio.luck@pep.foundation>
parents:
diff
changeset
|
144 |
decl title alias columnTitle; |