Semi-Structured Syntax

The world needs another semi-structured syntax. Although it has many benefits, XML has many flaws, and it would be nice to get the benefits without the flaws. This is the specification of Semi-Structured Syntax (SSS), a proposal for a standard that competes with XML. The principal point in favour of SSS is that it is designed to be as legible by humans as possible, so that it can be used for things like programming languages. SSS remains readily legible by machines too.

So begins the SSS specification. It's 18 pages long. Read it. It might make your life better.

For a quick taste of SSS, take a look at the grammar of a simple SSS-based programming language and compare it to a program in that language and the errors that the parser finds in it.


On this site you will find everything you need to use SSS, including:

Reference implementation

Where the reference implementation diverges from the specification, the specification is correct. The reference implementation is provided as an illustration of how SSS can be implemented. In writing it, I have concentrated on making it legible, correct and portable. In particular, it includes extensive documentation. If you want to implement an SSS lexer and parser, for example in a new programming language, you could do worse than to imitate the reference implementation (in my humble opinion).

The reference implementation is written in Java. It requires at least version 1.2 of Java, because it uses the collections library (Sets, Lists and Maps). It would not take much work to get it working on version 1.0, but it would be less work to upgrade your Java VM to the latest version (I recommend Sun's own JVM).

To run a program using the SSS libraries, simply include the JAR file in the classpath. For example, to run the Calculator program, included with SSS as a worked example, type the following command:

   java -cp sss.jar org.sc3d.apt.sss.v3.Calculator
(all the SSS libraries reside in the package org.sc3d.apt.sss.v3, so named because I wrote two versions to throw away before I wrote this final version).


Everything on this site is copyright Alistair Turnbull (March 2004). You may use the reference implementation only under the terms of the GNU Public Licence. It comes with no warranty.


One lexer and parser generator work for all SSS formats. That is one of the advantages of using a semi-structured syntax. The SSS lexer and parser have been implemented in the following programming languages:

If you'd like to port them to your favourite language, get in touch. I'm particularly keen to get them ported to Perl, Python and C.

Writing the reference implementation of the SSS libraries (just under 9000 lines of Java, including documentation) took me about four months. However, that included a lot of design decisions, experiments with data structures and algorithms, and unfortunate discoveries. I was also conscious that I was writing a reference implementation, and I therefore made a great effort to write legible code. You would not have to repeat all that, so porting SSS would not take nearly so long. Obviously the time required would depend on the language and programmer, but you might expect it to take four weeks. I would be happy to provide technical support.

Syntax-colouring modes

One syntax-colouring mode works for all SSS formats. That is one of the advantages of using a semi-structured syntax. Syntax-colouring modes have been written for the following text editors:

If you'd like to write an SSS mode for your favourite text editor, get in touch. I'm particularly keen to get modes written for emacs and vi.

Writing a syntax-colouring mode for NEdit took me about four hours, including learning how to do it. However, that included a lot of experimentation with different regular expressions. That experience is now written up in the specification, so you would not have to repeat all that. Writing a new mode would not take nearly so long. I would be happy to provide technical support.

Contact details

Send email to SSS @ this domain. (I have obfuscated the address to fox spambots.)