January 2012

Cool Language Compiler Example – Compilers courses

coolc is a limited class use COOL (Classroom Object Oriented Language) compiler written in C using LEX and YACC. coolc will perform an almost complete static type-check on the given file and generate the intermediate code in a three-address language for a limited subset of the COOL constructs. The three-address code will then be interpreted by the built-in interpreter and the output displayed to the user. coolc doesn’t fully support all the COOL language constructs. coolc main features are centered around the developing of the dispatch construct of COOL: ID.ID():void Therefore, briefly, coolc is able to handle: definition of classes without inheritance definition of attributes of various types in classes definition of methods in classes definition of dispatching methods in methods body without parameters and without a return value

Compiler COOL Lex Teaching Material Yacc

2 minutes