Cedalion: Everything’s a Language


Cedalion is a programming language, probably unlike any programming language you’ve seen before. When you think about programming languages, you probably think of text files, with lines written in some syntax that has been determined by someone you don’t know, for reasons you don’t always understand. If you get the syntax wrong, you’ll get a compilation error, or a runtime error. The language itself does not have the power to help you get it right from the start. There are tools and IDEs (such as some Eclipse-based editors) that help you with that, but at the end of the day, you’re using a text editor to enter your code as text, hoping the language tools will understand what you meant…

And it’s not only that. The syntax of most programming languages is fixed. If Java has syntax for expressing classes and methods, it is a good language to write any kind of software that can be easily expressed using classes and methods. However, not everything can. For example, hierarchical state-machines do not map nicely to classes. It is certainly not hard to implement a hierarchical state machine in a language such as Java, just that the state-machine terminology will be expressed using Java constructs, making it sometimes hard to understand and to modify.

Cedalion is different. First, it is different in the fact that Cedalion code is not edited in a text file, and not using a text editor. Cedalion is a programming language that is bundled with a projectional editor. With the Cedalion projectional editor (named the Cedalion Workbench) code is entered as a hierarchy of language constructs, and not as a stream of characters. It is impossible to make syntax errors in Cedalion , because there is no syntax – at least not in the usual sense. Instead of having you write the code in the correct syntax, Cedalion allows you to select syntactic elements, and then renders the code in a nice syntax so that the code is easy to understand.

Unlike most languages, that have a fixed syntax, Cedalion‘s syntax is extensible. It means that you can add language constructs for anything you have in mind, so long that you can also define it semantically. For example, if you need to implement a hierarchical state machine, you can still implement it using existing language constructs, but you can also create a new set of language constructs to express a state-machine, a state, a transition etc. This will allow you to express your state machine the same way you think about it. Of course you will still need to tell Cedalion how these constructs map into something else, something that Cedalion already understands, but you only have to do this once. Once you’ve done it, you don’t need to worry about it anymore, and you can use the abstraction you’ve created (in this case, the state-machine notation) to express any state-machine you need.

Creating new language constructs is so easy in Cedalion that it is the only way it provides for defining new things.  Everything’s a language.  You want to define a new function? Not a problem.  Cedalion’s base image includes a library for supporting functional programming.  You need to declare your function as a new concept (give it a type signature) and then define its meaning using an expression.  You may, but not have to, provide this function with its own syntax.  The factorial function can be expressed as fact(N) (using Cedalion’s default syntax), but you can make it look like !N.

With absolute control over what things look like and what they mean, Cedalion democratizes the language creation process.  No more a language created and controlled by some benevolent dictator. Languages are libraries, and everyone can create their own libraries.  Libraries can be combined easily.  Parsers cannot be easily combined.  This is why Cedalion does not use a parser, and uses projectional editing instead.


Academic Research Papers

See here