Som language is used for teaching. It has been used in computer
architecture class to teach how high level programming languages and
machine codes are related. The whole language translation process is
simple enough that students can modify it to generate code for their
architectural studies. The whole compiler and code generator is
around 2500 lines of Som. Here is an example from a part of the compiler,
the action routines.
Som has a familiar syntax, it is designed to be minimal to make it
easy to understand. It has a simple static memory model for
efficiency, and it also has dynamic allocation for flexibility. The
source is compiled into an efficient intermediate code (s-code
family) which runs on its virtual machine (around 300 lines of
C). It also has an interactive mode, an expression can be typed in
and is evaluated immediately. Som has a minimal set of operators as
it is intended to be used as a teaching tool. It has small set of
reserved words:
to, if, else, while, for, case, break, enum.
See the following example:
> print 2 + 3 nl
5
> to sq x = x * x
> print sq 4 nl
16
>
The release includes all source of compiler system (in Som) and the virtual machine (in C) and the executable vm compiled on Windows XP platform, Vista and Windows 7. It also contains a bit of test file and examples. The whole package is very small 100K-300K bytes (zip).
5 December 2009 |
Som v 5.0
new t2-code vm |
readme |
22 September 2009 |
Som v
4.2a new parser generator |
readme |
9 September 2009 |
Som v
4.2 Triple 9 release |
readme |
9 August 2008 |
Som v 4.1
Birthday release |
Happy
birthday Som readme |
2 July 2007 |
Som v 4.0
fast u-code vm |
readme
|
19 August 2007 |
Som v 3.1
fast sx-code vm |
readme |
Earlier versions
Release history
Part I The language
motivation
syntax
examples
design decision
string
macro
Part II Internals
s-code
lexical generator
compiler
parser generator
parser generator v 2
parse tree
code generation
optimisation
optimisation for
macro and/or (in Som v 4.0)
optimisation in
Som 5.0
Part III VM
Object file format
System call
S-code virtual machine
T-code
som v 1.7
Sx-code
som v 3.0
U-code
som v 4.0
U-code improved
som v.4.1
T2-code
som v 5.0
Part IV Miscellaneous
compile to a stack processor
converter to SM-code
extension of s-code
Appendix
conveniences
indentation as block
Som v 1.0
Som v 2.0
(Som-in-Som) readme
Som v 1.5 (with
macro) readme
Som v 1.7
(t-code vm) readme
Som v 1.8 (bug
fixed v 1.7) readme
Som v 2.4
(Som-in-Som for 2007) readme
(it achieved self-compiling!)
Som v 3.0 (Som-in
Som with new sx-code VM) readme
Som v 3.1 (fast
sx-code VM) readme
Som v 4.0 (u-code
VM) readme
Som v 4.1
(improved u-code and compiler) bug fixed (18 Aug
2008) readme
Som v 4.2
(lex as built-in function) readme
Som v 4.2a (new
parser gen) readme
Som v 5.0
(new t2-code vm) readme
How to compile Som suite
How to generate som.obj (for som v
2.4)
Example session
Happy birthday Som (2008)
related to Som language, stack-processors and virtual machines
reformat for maintenance 28 May 2022