Som Language

Som is a simple language that is complete enough to be self-hosting, that is, its compiler and its virtual machine are written in Som.  It is small, the whole package is around 2,000 lines of code written in Som so it can be read and understood by one person in a short time.

Som language has been use in teaching computer architecture, compiler and machine language in my classes for the past 10 years.  Its compiler front end is driven by an automatically generated parser.  (The parser generator in Som is provided). The back end is easily retarget to different machine langauges.

Here is a sample of the language.

Som's virtual machine has an interesting development.  It started the life as a zero-address (stack-based) instruction set and evolved through one-address and then three-address formats.  In fact, the history of Som's virtual machine read like a study in instruction set evolution.  Read Som's birthday report to know more.

Som's environment includes a batch-mode compiler and an interactive one.  Here is an example of an interactive sesssion:

If you are curious about language design, compiler construction or virtual machine instructions, then you are welcome to try Som.  The package is extremely small.  All source files and the executable virtual machine plus the compiler object is under 100K bytes.

Because of its smallness, it can be use as an embedded language, or it can be modify for a domain-specific language (through the change of grammar) easily. Hope you enjoy playing with Som.

