glc - A Go to Crystal compiler

glc is a compiler for a subset of the Go programming language. It is written in Rust, targets Crystal and won the 2019 GoLite competition at McGill University. For this project, we leveraged the Rust programming language’s type-safety to create a reliable, resilient and fast compiler.

Execution speed of the code outputted by glc on six standard benchmarks. Comparisons are made with the code outputted by an equivalent Go to C++ compiler and Go to Python compiler. Our performance is significantly better than that of unoptimized C++ and Python. It also compares favorably with optimized C++ in almost all benchmarks.

glc is built with the Logos lexer and lalrpop, an LR(1) parser generator. It provides detailed error messages in a style similar to that of the Rust compiler.

Examples of glc error handling.