this is a project for Stanford CS143, the goal is to write a simple compiler for COOL(a simple object oriented language for teaching) language. The project contains five assignment. After fulfilling the project, we are able to be acquaint with front end and basic code generation part of the compiler.
- fulfill a stack machine in COOL
- be acquaint with COOL syntax and structures
- fulfill a lexer in flex
- be acquaint with COOL syntax rules
- be acquaint with flex grammer
- fulfill a parser in bison, target language is COOL
- be acquaint with bison parsing tools
- learn LALR recursive parsing tech and how to handle shift-reduce conflicts
- fulfill a semantic analyzer for COOL language
- fulfill a type system, with type checking and type inferencing
- decorate AST tree with type information, as a helper for code gen in next phase