Reference manual describing the syntax, semantics, and type system of the Cool programming language.
About this manual
The Cool Reference Manual provides a complete description of the Classroom Object‑Oriented Language (Cool). It covers language constructs such as classes, inheritance, types, attributes, methods, and expressions, and explains the static type system and operational semantics.
The manual also includes practical information on compiling and running Cool programs, including command‑line usage of the coolc compiler and the SPIM MIPS simulator.
What's inside
- Introduction
- Getting Started
- Classes
- Types
- Attributes
- Methods
- Expressions
- Lexical Structure
- Type Rules
- Operational Semantics
Frequently asked questions
How do you compile a Cool program?
Use the coolc command, e.g., `coolc [ -o fileout ] file1.cl file2.cl … filen.cl`.
How do you run a compiled Cool program?
Load the generated assembly file into the SPIM simulator with `spim -file file.s` and run it.
What is the purpose of SELF_TYPE in Cool?
SELF_TYPE refers to the type of the `self` variable, allowing methods to return the dynamic type of the receiving object.