Source §2 Typed is a small programming language, designed for the first chapter of the textbook Structure and Interpretation of Computer Programs, JavaScript Adaptation (SICP JS). Source §2 Typed introduces type syntax and type checking.
What is static type checking?
Programming languages handle types in two main ways: dynamically typed languages, only check types when the code is run (at runtime), while statically typed languages check types before the code is run (at compile time). Though Source is a dynamically typed language, we can still introduce type checks that check the code for errors at compile time.
What can you do in Source §2 Typed?
You can use all features of Source §1 Typed and Source §2, but with the following additional types:
null
types- Pair type (
Pair<headType, tailType>
): takes in two type parameters, head type and tail type - List type (
List<elemType>
): takes in one type parameter, element type
You want the definitive specs?
For our development team, we are maintaining a definitive description of the language, called the Specification of Source §2 Typed. Feel free to take a peek!