Department or Program

Computer Science

Primary Wellesley Thesis Advisor

Franklyn Turbak


In blocks programming languages, such as Scratch and App Inventor, programs are created by connecting visual program fragments shaped like jigsaw puzzle pieces. The shapes of these blocks help novices avoid frustrating syntax errors commonly encountered in textual programming languages by strongly suggesting how expressions and statements are composed to form programs. In statically typed programming languages, every expression has a type that indicates the kind of value it denotes (e.g. number, string, boolean). Types allow a programmer to more effectively reason about the behavior of their program. In blocks languages, the shapes of the block connectors can be used to indicate type, but they currently handle only simple types and do so in an ad hoc and confusing fashion. For example, in Scratch numbers and strings have the same shape, allowing users to do nonsensical things such as find the square root of a string.

The goal of this project is to create a blocks version of a language similar to ML, a statically typed programming language with expressive types. For example, the ML type (int list) * (string list) -> (int * string) list describes a function that takes as arguments an integer list and string list and returns as a result a list whose elements are pairs of integers and strings. I developed TypeBlocks, a statically typed blocks language for a functional language with list, tuple, and function types implemented in the blocks framework ScriptBlocks. In TypeBlocks, each arbitrarily complex type is translated into a unique connector shape. TypeBlocks also handles ML-style universal polymorphism. This project aims to aid novice programmers and help them more clearly comprehend types.