Skip to content

Commit 9c7a7fc

Browse files
committed
preliminary homepage
1 parent c568ae4 commit 9c7a7fc

File tree

1 file changed

+213
-0
lines changed

1 file changed

+213
-0
lines changed

index.html

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
*{margin:0;padding:0;}
7+
body {
8+
font:13.34px helvetica,arial,freesans,clean,sans-serif;
9+
color:black;
10+
line-height:1.4em;
11+
background-color: #F8F8F8;
12+
padding: 0.7em;
13+
}
14+
p {
15+
margin:1em 0;
16+
line-height:1.5em;
17+
}
18+
table {
19+
font-size:inherit;
20+
font:100%;
21+
margin:1em;
22+
}
23+
table th{border-bottom:1px solid #bbb;padding:.2em 1em;}
24+
table td{border-bottom:1px solid #ddd;padding:.2em 1em;}
25+
input[type=text],input[type=password],input[type=image],textarea{font:99% helvetica,arial,freesans,sans-serif;}
26+
select,option{padding:0 .25em;}
27+
optgroup{margin-top:.5em;}
28+
pre,code{font:12px Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;}
29+
pre {
30+
margin:1em 0;
31+
font-size:12px;
32+
background-color:#eee;
33+
border:1px solid #ddd;
34+
padding:5px;
35+
line-height:1.5em;
36+
color:#444;
37+
overflow:auto;
38+
-webkit-box-shadow:rgba(0,0,0,0.07) 0 1px 2px inset;
39+
-webkit-border-radius:3px;
40+
-moz-border-radius:3px;border-radius:3px;
41+
}
42+
pre code {
43+
padding:0;
44+
font-size:12px;
45+
background-color:#eee;
46+
border:none;
47+
}
48+
code {
49+
font-size:12px;
50+
background-color:#f8f8ff;
51+
color:#444;
52+
padding:0 .2em;
53+
border:1px solid #dedede;
54+
}
55+
img{border:0;max-width:100%;}
56+
abbr{border-bottom:none;}
57+
a{color:#4183c4;text-decoration:none;}
58+
a:hover{text-decoration:underline;}
59+
a code,a:link code,a:visited code{color:#4183c4;}
60+
h2,h3{margin:1em 0;}
61+
h1,h2,h3,h4,h5,h6{border:0;}
62+
h1{font-size:170%;border-top:4px solid #aaa;padding-top:.5em;margin-top:1.5em;}
63+
h1:first-child{margin-top:0;padding-top:.25em;border-top:none;}
64+
h2{font-size:150%;margin-top:1.5em;border-top:4px solid #e0e0e0;padding-top:.5em;}
65+
h3{margin-top:1em;}
66+
hr{border:1px solid #ddd;}
67+
ul{margin:1em 0 1em 2em;}
68+
ol{margin:1em 0 1em 2em;}
69+
ul li,ol li{margin-top:.5em;margin-bottom:.5em;}
70+
ul ul,ul ol,ol ol,ol ul{margin-top:0;margin-bottom:0;}
71+
blockquote{margin:1em 0;border-left:5px solid #ddd;padding-left:.6em;color:#555;}
72+
dt{font-weight:bold;margin-left:1em;}
73+
dd{margin-left:2em;margin-bottom:1em;}
74+
@media screen and (min-width: 768px) {
75+
body {
76+
width: 748px;
77+
margin:10px auto;
78+
}
79+
}
80+
</style>
81+
<title>
82+
83+
84+
85+
86+
87+
88+
89+
90+
self-ml ^1 is a structural data language designed to be written by</title>
91+
</head>
92+
<body>
93+
<!-- Title: Introducing self-ml -->
94+
95+
96+
<!-- Subtitle: A human data format -->
97+
98+
99+
<!-- Slug: self-ml -->
100+
101+
102+
<p>self-ml<a href="self-ml">^1</a> is a structural data language designed to be written by humans and read by computers. Its syntax is based on <a href="http://en.wikipedia.org/wiki/S-expression">S-expressions</a> with some changes and simplifications.</p>
103+
104+
<div class="sidebar"><div class="inner"><h3>Why not <strong>JSON</strong>?</h3><p><a href="http://www.json.org/">JSON</a> is a great computer  ↔  computer format. It's ideal for RSS feeds or the output of a website's API.<p>
105+
106+
<p>self-ml is designed as a human  ↔  computer format. Its main use is for configuration files and structured data.</p></div></div>
107+
108+
109+
<p>The biggest feature of self-ml is its simplicity. It <em>doesn&rsquo;t</em> have attributes, namespaces, dictionaries, symbols or even numerics. Lists and strings are all you got.</p>
110+
111+
<table class="code comparison"><tr><th>self-ml</th><th>XML</th></tr>
112+
<tr><td>(empty-tag)</td> <td>&lt;empty-tag/></td></tr>
113+
<tr><td>(vegetable Potato)</td> <td>&lt;vegetable>Potato&lt;/vegetable></td></tr>
114+
<tr><td>(vegetables Potato Carrot Onion)</td> <td>&lt;vegetables><br>
115+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;vegetable>Potato&lt;/vegetable><br>
116+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;vegetable>Carrot&lt;/vegetable><br>
117+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;vegetable>Onion&lt;/vegetable><br>
118+
&lt;/vegetables></td></tr>
119+
<tr><td>(person [John Smith])</td> <td>&lt;person>John Smith&lt;/person></td></tr>
120+
<tr><td>(code [NSMutableString *str = [[[NSMutableString alloc] init] autorelease];])</td> <td>&lt;code>NSMutableString *str = [[[NSMutableString alloc] init] autorelease]&lt;/code></td></tr>
121+
<tr><td>(student [Robert'); DROP TABLE Students;--])</td> <td>&lt;student>Robert'); DROP TABLE Students;--&lt;/student></td></tr>
122+
<tr><td>`Some complex data !@£$%^&*<([{/`</td> <td>&lt;![CDATA[Some complex data !@£$%^&*<([{/]]></td></tr>
123+
<tr><td># A line comment</td> <td></td></tr>
124+
<tr><td>{# A block<br>comment #}</td> <td>&lt;!-- A block<br>comment --></td></tr>
125+
<tr><td>(apple<br>
126+
&nbsp;&nbsp;&nbsp;&nbsp;(music<br>
127+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iPod<br>
128+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iTunes)<br>
129+
&nbsp;&nbsp;&nbsp;&nbsp;(computers<br>
130+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iMac<br>
131+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Mac mini])<br>
132+
&nbsp;&nbsp;&nbsp;&nbsp;(phones<br>
133+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iPhone)<br>
134+
&nbsp;&nbsp;&nbsp;&nbsp;(dishwashers))</td> <td>&lt;apple><br>
135+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;music><br>
136+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;product>iPod&lt;/product><br>
137+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;product>iTunes&lt;/product><br>
138+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/music><br>
139+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;computers><br>
140+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;product>iMac&lt;/product><br>
141+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;product>Mac mini&lt;/product><br>
142+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/computers><br>
143+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;phones><br>
144+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;product>iPhone&lt;/product><br>
145+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/phones><br>
146+
&nbsp;&nbsp;&nbsp;&nbsp;&lt;dishwashers/><br>
147+
&lt;/apple></tr>
148+
</table>
149+
150+
151+
<p>As you can see, especially from the last example, self-ml is a lot more succinct than XML, easier to read and easier to write. There&rsquo;s not a single backslash escape in sight: self-ml is Regex Friendly™. self-ml can have lists of strings <code>(music iPod iTunes)</code> and multiple nodes under the root node.</p>
152+
153+
<h3>Casual Grammar</h3>
154+
155+
<div class="warning"><strong>Warning:</strong> Technical details ahead. <a href="#implementations">Skip to details on implementations</a>.</div>
156+
157+
158+
<p>A <em>node</em> is the basic unit of self-ml. A node can either be a <em>list</em> or a <em>string</em>.</p>
159+
160+
<pre><code>node := list | string.</code></pre>
161+
162+
163+
<p>A <em>list</em> comprises of a <em>head</em> and a list of other nodes, enclosed in round brackets. For example, <code>(head node1 node2 node3)</code>. Unlike usual s-exprs, the empty list <code>()</code> is not accepted.</p>
164+
165+
<pre><code>list := '(' string node_list ')'.
166+
167+
node_list := node_list node.
168+
node_list := node_list.
169+
node_list := .</code></pre>
170+
171+
172+
<p><em>Strings</em> can be written in three forms:</p>
173+
174+
<pre><code>string := BACKTICK_STRING | BRACKETED_STRING | VERBATIM_STRING.</code></pre>
175+
176+
177+
178+
179+
<ol>
180+
<li><p>If it contains no whitespace or brackets, then it can be written verbatim. For example, <code>some-string</code>.</p><pre><code>VERBATIM_STRING := [^[\](){}\s]+</code></pre></li>
181+
182+
<li><p>If all square brackets in the string are balanced, then it can be written enclosed in square brackets. For example, <code>[NSMutableString *x = [[[NSMutableString alloc] init] autorelease];]</code>.</p><pre><code>BRACKETED_STRING := '[' ... deal with nested brackets ... ']'</code></pre></li>
183+
184+
<li><p>If you need to express unbalanced square brackets <code>[ ]</code> then you can use a *backtick string*. A backtick string starts at a <code>`</code> continues until another <code>`</code> is found, unless that backtick has another backtick after it (two backticks insert a single backtick into the backtick string). For example, <code>`This is a ``backtick`` string`</code>.</p><pre><code>BACKTICK_STRING := `(``|[^`])*?`</code></pre></li>
185+
</ol>
186+
187+
188+
<p>The <em>root node</em> is a list containing all top level nodes in the document. As mentioned, you can have any number of top level nodes, including zero.</p>
189+
190+
<pre><code>root := node_list.</code></pre>
191+
192+
193+
<p>There are two types of comments. Comments may only occur outside of bracketed and backtick string literals.</p>
194+
195+
<ol>
196+
<li><p>Line comments start at <code>#</code> and continue until a <code>CR</code>, <code>LF</code>, <code>CR LF</code> or other newline character sequence is found.</p><pre><code>LINE_COMMENT := #.*$</code></pre></li>
197+
198+
<li><p>Block comments start at <code>{#</code> and end when a matching <code>#}</code> is found. Block comments may be nested.</p><pre><code>BLOCK_COMMENT := \{#.*?#\}</code></pre></li>
199+
</ol>
200+
201+
202+
<p><a name="implementations"></a></p>
203+
204+
<h3>Implementations</h3>
205+
206+
207+
<p>I have written an implementation in C. It&rsquo;s <a href="http://github.com/fileability/self-ml">available on github</a>.</p>
208+
209+
<p>Other implementations are of course welcome! As are text editor plugins, testcases, documentation, patches, etc. Contact me <a href="http://github.com/inbox/new">on github</a> or email <a href="&#109;&#97;&#x69;&#108;&#x74;&#111;&#58;&#x61;&#x6e;&#121;&#116;&#104;&#105;&#x6e;&#x67;&#64;&#x66;&#x69;&#x6c;&#x65;&#97;&#98;&#x69;&#x6c;&#x69;&#x74;&#x79;&#x2e;&#110;&#101;&#x74;">&#97;&#110;&#121;&#x74;&#x68;&#105;&#x6e;&#103;&#64;&#x66;&#105;&#108;&#x65;&#x61;&#x62;&#x69;&#x6c;&#x69;&#x74;&#121;&#x2e;&#x6e;&#x65;&#x74;</a>.</p>
210+
211+
<p><em>Edit:</em> There&rsquo;s now a very simple <a href="http://dequechair.com/self-ml-textmate.zip">textmate bundle</a></p>
212+
</body>
213+
</html>

0 commit comments

Comments
 (0)