#compiler #language #esolang

app lolcode

A simple Lolcode to C compiler

4 releases (2 breaking)

0.3.1 Jul 9, 2022
0.3.0 Jul 8, 2022
0.2.0 Jul 8, 2022
0.1.0 Jul 8, 2022

#902 in Programming languages

MIT license

40KB
1K SLoC

LolC

A simple Lolcode to C compiler. Written in Rust.

Installation Instructions

lolc requires an up-to-date installation of Cargo.

cargo install lolcode

What is Lolcode?

Lolcode is an esolang, or esoteric programmming language. Its syntax is intentionally humorous and makes it difficult to use in production use. Subsequently, Lolcode is used exclusively as a joke in the software development community.

Why does this exist?

I developed this Lolcode compiler to help solidify an understanding of Pratt parsing. The parser for Lolcode is based on the principles of Pratt parsing.

Credit to Bob Nystrom at Stuff With Stuff for a really great article that helps explain Pratt parsers. Nystrom uses Java in his implementation (and I use Rust here) but he explains every step very clearly.

Credit to Austin Henley for a great guide on writing compilers.

Credit to Revanth Pothukuchi (GitHub user Hacker007) for explaining to me the parser in his language Envious's compiler, envyc.

Why write it in Rust?

I decided to write this in Rust for a few reasons:

  • Effective & safe type polymorphism
  • Effective error handling
  • Speed
  • I know Rust much better than C++

Dependencies

~1–10MB
~71K SLoC