Chapter 2 Classroom Object Oriented Language (COOL)
COOL is a small object oriented language. It has many features of an object oriented language. You can write many simple programs in COOL language. We shall be using COOL as our source language. Our aim in this course is to develop a compiler that can translate COOL programs into executable code.
(* hello-world.cl *)
class Main inherits IO {
main() : Object {
out_string("Hello, world.\n")
} ;
} ;
You can download the relevant COOL stuff from the following links
To run COOL programs:
- Download COOL examples and extract it in a folder
- Unzip the cool-examples folder
- Open a COOL example in Visual Studio Code
- Open terminal in Visual Studio Code
- Change to the cool-examples directory
- Type the following command
cool hello-world.cl
You can also compile COOL code online using the following transpiler: Online COOL Compiler