ChatLang: Algebraic Effects
jfdoming (0)


Welcome to ChatLang! This is a language entirely created by two undergraduate university students over the course of the language Jam, for the purpose of exploring an idea called "algebraic effects" as well as some other quirky syntactic sugar (for example, see this blog post) in a more C-like language. (It was also for the experience of building a language from scratch! 😅)


Just click the run button, or run ./lang <filename> where <filename> is a name of a file to execute. For example, ./lang samples/main.lang is the file set to run by default. You can also get a REPL by running ./lang by itself, though currently you have to send the EOF character (Ctrl-D on Unix-like systems) to actually evaluate your code.


We decided to tackle this project without any libraries other than the C++ standard library! This meant building a custom tokenizer, grammar format, parser generator and interpreter. This was a huge adventure reliving past trauma experiences in our compilers course, and was an even bigger undertaking because this time, we were embarking on our language creation journey without any starter code.

The biggest challenge we ran into was that it turns out rolling your own language framework takes a lot of effort! This left us with not much time to create the actual language. However, we persevered and the language you see is the result!

Our choice of C++ as a language for the interpreter also resulted in some challenges: memory leaks, use-after-frees, and more. Luckily, we were able to figure these out with the help of valgrind and gdb!

Next steps for ChatLang

After the competition is complete, we hope to add a compiled version of the language. This is partially because we were more experienced at building an optimized compiled language as opposed to an optimized interpreted one, and at any rate, interpreted languages generally perform worse than compiled ones. Alternatively, we may attempt to write a virtual machine and corresponding bytecode format for the language (à la JVM) with the goal of portability and speed together. Either way, we're looking forward to adding new features and getting feedback!

There are also many other language features which we'd like to implement, such as a standard library, and many bugs to fix. We're happy with the progress from zero to a working build we made during this language jam, though!

Other notes

The team Repl is and I (@jfdoming) worked on this project together with @jyzh1248.

You are viewing a single comment. View All
jfdoming (0)

@CodeLongAndPros oh, Hmm, I didn't know that! I guess I've been using Git bash for so long that I got mixed up. Thanks for the correction!