My last update to Som compiler was in January 2011. I plan to do som2c
converter. So, now is the good time to do it (for celebrating the new year
to come!).
The new vm is written in Som and convert to C. Now Som will be almost 100%
self-hosting (include the vm itself). The lex is also being moved back
into Som to make the vm as clean as possible. Of course, not everything
can be written in Som. A number of i/o functions need to be in C for the
compiler to run but I keep that to the minimum. Som sources contain 2483
lines (compiler 2215, vm-som 268). The C support is 598 lines (half is .h
files). Another 385 lines of C is converted from vm in som. Now, to modify
Som, one needs only to inspect Som source. Som2c is used to convert the
vm part into C. Because Som is similar to C, the output of the converter
for vm part is almost the same as the one written in C (compared to
som-v51 vm version) so the performance is the same as version 5.1.
The steps to develop vm ins som and som2c
converter are also a good educational read. It is under the
directory som2c of the package. For pure Som vm, please
read it here (it is for t2 64-bit).
This new compiler is tested with all previous programs (from som.v51)
except the one that need lex in vm (parser, pgen).
Enjoy Som code and merry Christmas and Happy New Year 2013!
Prabhas Chongstitvatana
10 November 2012