Newspeak is a dynamic, class-based, purely object-oriented language in the tradition of Smalltalk and Self. SOMns is an implementation of the Newspeak Specification Version 0.0.95 derived from the SOM(Simple Object Machine) class libraries, and based on the TruffleSOM. Thus, SOMns is implemented using the Truffle framework and runs on the JVM platform.
A simple Hello World program looks like:
class Hello usingPlatform: platform = (
public main: platform args: args = (
'Hello World!' println.
^ 0
)
)
SOMns is implemented as self-optimizing AST interpreter using the Truffle framework. Thus, it can utilize the Truffle support for just-in-time compilation to optimize the execution performance at runtime. It is completely file-based and does not have support for images. The parser is written in Java and creates a custom AST that is geared towards representing the executable semantics.
The overall goal is to be compliant with the specification, but include only absolutely necessary features. The current list of intended deviations from the specifications are as follows:
-
the mixin support of slots is not yet complete, see deactivate tests in core-lib/TestSuite/MixinTests.som
-
simultaneous slots clauses are not supported (spec. 6.3.2)
-
the file syntax is adapted to be more practical. This includes that category names are optional instead of being mandatory.
-
setter send syntax is still based on the classic Smalltalk
:=
-
local variables in methods do not yet support the full slotDeclartion style
-
as in SOM method chains are not supported
-
as in SOM, blocks can only have 3 arguments (counting
self
)
This is a brief guide, a more comprehensive overview is available here: Getting Started Guide.
To checkout the code:
git clone https://github.com/smarr/SOMns.git
Then, SOMns can be build with Ant:
ant
Afterwards, the simple Hello World program is executed with:
./som core-lib/Hello.som
Information on previous authors are included in the AUTHORS file. This code is distributed under the MIT License. Please see the LICENSE file for details.
-
Install JDK 1.8 and Eclipse Mars (or later)
-
Download the project from Github
git clone https://github.com/smarr/SOMns
-
Run
ant
on the command line, or via Eclipse, to make sure that all libraries are loaded and available. -
Create Truffle Eclipse projects with Truffle's mx build tool:
cd libs/truffle/
../mx/mx eclipseinit
-
Import SOMns project and the Truffle projects into Eclipse
-
For debugging the interpreter, create a run configuration with the Mandelbrot benchmark. In option Run Configurations go to Java Application/SOMns and select tab arguments, enter:
In Program arguments:
core-lib/Benchmarks/Harness.som Mandelbrot 2 0 500
In VM arguments:
-ea -esa
For testing on the command line, the full command is
$ ./som -G core-lib/Benchmarks/Harness.som Mandelbrot 2 0 500
Additionally, there are JUnit tests and ant test
for executing the test suite.
To use VS Code as IDE and debugger for SOMns programs, it needs to be installed manually from: https://code.visualstudio.com/Download
The SOMns support can then be installed via the Marketplace.
sudo add-apt-repository ppa:webupd8team/java
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt install oracle-java8-installer git ant npm nodejs
git clone --recursive https://github.com/smarr/GraalBasic.git
cd GraalBasic
yes "n" | ./build.sh
cd ..
git clone https://github.com/smarr/SOMns.git
cd SOMns
ant ## build SOMns
ant tests ## run all tests
cd libs/truffle
../mx/mx eclipseinit ## Generate all Truffle Eclipse projects
SOMns is designed as platform for research on concurrent programming models, and their interactions. Here, we collect related papers:
-
Optimizing Communicating Event-Loop Languages with Truffle, Stefan Marr, Hanspeter Mössenböck; Presentation at the AGERE!’15 Workshop, co-located with SPLASH’15.
-
Cross-Language Compiler Benchmarking: Are We Fast Yet? Stefan Marr, Benoit Daloze, Hanspeter Mössenböck at the 12th Symposium on Dynamic Languages co-located with SPLASH'16.