Although I can’t find it now, I think it was Dan Bernstein who said somewhere that programs should avoid syntax when possible. Using syntax means permitting syntax errors. Avoiding syntax means making syntax errors impossible.
Even if it wasn’t Bernstein who said this, you can see the idea in action in things like his tinydns configuration file format. There are no keywords or grouping constructs. Each statement is a single line. The first character on the line indicates the type of statement.
The expectation is that if people want a more comprehensible syntax, they will write a separate program which will read something and generate the un-syntax. That way any problems are isolated to that separate program. (Actually tinydns-data is itself a separate program which reads the un-syntax and turns it into a binary form for the tinydns program.)
I think this idea deserves wider use. It fits with the general idea that modules should be independent. When you have a program which needs to read some data, that format of that data should be as simple as possible. When it is desirable to permit a more complicated representation, that should be done by providing a mechanism to convert the complicated representation to the simple one.
Programming languages are of course a sinkhole of syntax. That said, an example of a programming language with minimal syntax is sed. For those with only a passing familiarity with sed, it is surprisingly powerful, and the t and T commands make it Turing complete. It would not be a satisfactory language for general purpose programming, but it is quite effective in its own domain. Another language with minimal syntax is, of course, APL.
Leave a Reply
You must be logged in to post a comment.