Bistro Smalltalk

Bistro is a variation of Smalltalk that integrates the best features of Smalltalk and Java. Bistro Smalltalk is an experimental programming language that runs on the Java Virtual Machine, or JVM.

Bistro Smalltalk preserves much of the simplicity, expressiveness and readability of standard Smalltalk. Apart from a few minor differences in punctuation, the method syntax of Bistro Smalltalk is almost identical to that of standard Smalltalk. Thus, Bistro Smalltalk offers software developers the ability to design and build software models with a syntax that approaches the expressiveness and readability of natural language. However, Bistro Smalltalk incorporates several language features from Java to better support their integration.

Bistro Smalltalk provides class libraries that implement the standard Smalltalk protocols for code portability, along with optional types, and type erasure, to ease integration with existing host VMs and Java class libraries.

Unlike many Smalltalks, Bistro does not provide its own virtual machine VM. Instead, Bistro takes advantage of already existing virtual machines that have matured over the past few decades.

Also, Bistro does not use image-based persistence for storing its code. Rather, like many other programming languages, it uses simple text files. This allows developers to use popular tools for editing and source code version control.

Platform Requirements

Bistro has been upgraded to use (and now requires at least) Java SE 8 JDK. Bistro 3.8 updates its usage of collection classes and streams to those that became available in Java 8. Bistro 3.8 substantially simplifies its code generator with StringTemplate. Bistro 3.8 also migrates the build process from Ant to the more modern Gradle.

Project Installation

Clone this repository and perform (one of) the following Gradle command in the cloned work folder.

In Linux:

./gradlew clean test

In Windows:

gradlew clean test

This will build the compiler, then compile the Bistro library sources using the Bistro and Java compilers (combined), and then run the various tests of the library code using the library test fixtures.

The Bistro Compiler and Class Library

This repository contains the Bistro compiler, class libraries, and design documentation. Overall, the Bistro compiler performs source-to-source translation, from Bistro code to Java. Then, the Bistro compiler uses a standard Java compiler to translate the intermediate Java source code into Java class files. The generated Java class files can then be packaged as JARs, deployed with and run on any compliant JVM.

The Bistro compiler is built with ANTLR 3.5.2. The parser (generated by ANTLR) recognizes the code in Bistro source files and builds an abstract syntax tree AST that captures the structure of the Bistro code. The compiler then generates Java code from the nodes of the AST using StringTemplate.

This repository contains the following modules:

Module Contents
bistro-compiler the Bistro compiler sources (Java code)
bistro-library the library classes (Bistro + Java code)
libs-smalltalk the library target (Java code) and test fixtures


The following table summarizes the important features of Bistro. For more details, see my last paper regarding Bistro. Each of the links below provides access to discussions of the specific design details. Note that the compiler and library code are still in transition, undergoing upgrades from the older Java libraries, and therefore subject to change.

Feature Description
Language Model Bistro has a declarative language model.
Name Spaces Bistro packages and name spaces are assigned based on folders.
Classes Bistro classes have a hybrid structure based primarily on Smalltalk.
Metaclasses Bistro supports metaclasses like those found in Smalltalk.
Types Bistro supports first-class interfaces (as types).
Metatypes Bistro types can have associated metatypes.
Library Bistro includes types that implement ANSI standard Smalltalk.
Access Control Bistro code may use access controls: public, protected, private.
Decorations Bistro also supports: abstract, final, static.
Optional Types Bistro variable and argument type specifications are optional.
Methods Bistro methods resemble those of Smalltalk.
Interoperability Bistro method names become compatible host method names.
Primitives Bistro supports primitive methods.
Comments Bistro comments are copied over to Java.
Blocks Bistro blocks are implemented with Lambdas.
Threads Bistro blocks support the fork protocol for spawning Java threads.
Exceptions Bistro supports both Smalltalk and Java exception handling.

Copyright 1999,2017 Nikolas S. Boyd. All rights reserved.