Sic%

About Sic%

Sic% is a Smalltalk implementation of the Pic% language, a variant of the Pico language with some features to support prototype-based object-oriented programming. An additional feature of Sic% is its linguistic symbiosis with the underlying Smalltalk system, which allows Pic% and Smalltalk objects to seamlessly send each other messages. With this technique Sic% programmers can easily leverage of the vast Smalltalk library for doing such things as GUI building, database access etc.

Sic% was originally developed for Squeak Smalltalk, but has since also been ported to VisualWorks Smalltalk.

Downloads

VisualWorks

Download Sic% 2004-12-2 for VisualWorks

Squeak

Sic% for Squeak is no longer actively developed, the last release is known to work for certain on Squeak 2.7 and 2.8, just follow the installation instructions included in the README file. The code should also work on Squeak 3.x versions, but instead of the loading script mentioned in the README you should use the following:

#('Parser' 'AbstractExpressions'
     'Natives' 'Reification' 'Absorption'
     'EvaluatorAndUI' 'GrafixCourseFor28' )
	do: [ :name |
		| filename file |
		filename _ name , '.1.cs'.
		file _ FileStream fileNamed:  filename.
		ChangeSorter newChangesFromStream: file named: filename.
		file close. ]

This version of the loading script avoids loading the EmptySymbolFix file, which is a patch no longer required for Squeak 3.x and actually even hangs the Squeak image when loaded.

Documentation

This documentation only provides an introduction to working with the VisualWorks version of Sic%. For documentation on the Squeak version, check out the examples morph which is included in its distribution package (instructions on opening it are in the README). For a general introduction to the Pic% and Pico languages see the Pico website. Note though that most of the documentation on that site covers Pico, Pic% is slightly different.

Setup

Once you've loaded the Sic% parcel you still need to do some setup before you can comfortably use Sic%. To allow you to evaluate Pic% expressions from any text field in VisualWorks using a shortcut key, just like you can do a "print-it" on any Smalltalk expression, you can define such a shortcut key using the MagicKeys package, which was normally installed automatically when you loaded Sic%.

From the Launcher, select the System > Settings menu, which should open the window depicted below. In that window, click the "Edit" button next to "MagicKeys bindings:".

You are now in the MagicKeys editor window, double click there on the key binding for "control-t":

in the next window, select "#keyboardPicoPrintIt:" from the drop down box on the right. Press the "Accept" button.

Back in the MagicKeys editor window, you should now press apply to finally set the new key bindings:

You can now open a workspace and type in an expression such as:

display(5)

When you then select the expression and press control-t, the number 5 should be printed on your transcript and <void> should be printed as the expression's evaluation result on your workspace.


Things to Try

This section covers a few interesting things you can try in Sic%. If you should run into problems, note that you can always evaluate the following expression in Smalltalk (not in Sic%, so don't press control-t) to reset the Pico Evaluator:

PicoEvaluator reset

The Visual Inspector

Sic% is integrated with the Psi Visual Inspector. Evaluate the following to create an object and open it in the Visual Inspector:

{
  makePoint() :: {
    x : 5;
    y : 7;
    getX() :: x;
    getY() :: y;
    setX(newX) :: x := newX;
    setY(newY) :: y := newY;
    clone()
  };
  p : makePoint();
  inspect(p)
}

Here's a screenshot of what you should get:

The Metacircular Evaluator

Sic% includes an implementation of a Pic% interpreter written in Pico. (So it is not really metacircular as it is not an implementation in the same language) To give it a try you first need to copy the files from the folder 'Metacircular Implementation' to the same folder as your VisualWorks image is in. Then evaluate the following Pico expression:

picoload('Make.txt')

This loads and evaluates the code in the file 'Make.txt'. The code in that file will load the other files necessary for the Pic% interpreter. Note the use of the 'picoload' function instead of 'load': Sic% actually includes an implementation of the regular Pico language as well (Pic% and Pico are not that different), the 'picoload' function evaluates the code in the loaded file using Pico instead of Pic% semantics. Once 'Make.txt' is evaluated you should get a dialog window asking you to provide input to the Pic% interpreter, just type any Pic% expression and press OK, the result of evaluating the expression will be printed on the Transcript.