ChatLang: Algebraic Effects
jfdoming (0)

ChatLang

Welcome to ChatLang! This is a language entirely created by two undergraduate university students over the course of the Repl.it 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! 😅)

Quickstart

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.

Challenges

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 https://repl.it/@ChatLang/ChatLang and I (@jfdoming) worked on this project together with @jyzh1248.

You are viewing a single comment. View All
TheDrone7 (1434)

Hello, this jam required you to work as a submit a team repl. I am moving this to the Share board for now. Reply to this comment if you worked as a team with at least 2 members after linking to the team repl in the post description and mentioning your team members in the post as well.

jfdoming (0)

@TheDrone7 Hey, sorry about that! We did actually work as a team. The team Repl was https://repl.it/@ChatLang/ChatLang and my teammate was https://repl.it/@jyzh1248/. Again, my bad for not mentioning it in the post. Is this enough info to be entered in the Jam? I hope that we aren't disqualified due to me not responding sooner, but either way please let me know! Thanks!

jfdoming (0)

@TheDrone7 hi again, any update on this? I'm really sorry for the multiple replies, but I just want to make sure this didn't get skipped over by mistake. Thanks in advance!

TheDrone7 (1434)

@jfdoming my bad for not replying, you are not disqualified.

jfdoming (0)

@TheDrone7 awesome, thanks for the reply! Does the post need to be moved back to the jam category, or is it already included? Again, many thanks!

TheDrone7 (1434)

@jfdoming it has already been moved back and included

jfdoming (0)

@TheDrone7 ah I see, my bad. Thanks for the help!