plum-umd / the-838e-compiler

Compiler for CMSC 838E
2 stars 0 forks source link

Implement Standard Libraries #35

Closed rybla closed 3 years ago

rybla commented 3 years ago

Standard Libraries

Standard libraries (stdlibs) are programs that are specially pre-compiled to object files, and then linked to executable programs (during the executable's compilation). Each stdlib "provides" a set of labels that can be used by any other program (including other stdlibs).

Compilation is broken up into normal (executable or Prog) compilation and library (Lib) compilation. Compiling a Lib to asm translates its provided ids to Global instructions.

The parser (specifically, externs.rkt) is hard-codedly aware of which ids are provided by stdlibs, so when a client references an stdlib provided id, an Extern instruction is generated.

The file stdlibs.md gives a more detailed summary of changes as well as instructions for adding new standard libraries.

Miscellaneous