I told my 2nd year CS students to create a programming language

I teach object-oriented programming using Java to 3rd semester Computer Science students at Federal University of Fronteira Sul. During their first years, the students attend to algorithms and data structures classes, all using C. I teach algorithms too.

I like to teach using assignments. During the last two semesters, my OOP/Java classes were followed by small assignments, every two weeks. Those assignments were strictly related to some topic being discussed during the classes. I was afraid to push my students too hard, so the tasks were easy (in my opinion) to understand and complete. I already told them to implement a tic-tac-toe game, a simple Android app (at the end of semester), a simplified bank management app, among others. However they are all boring tasks.

This semester I decided to take another approach. I wanted to push my students to the limits. After two months of classes, they were already familiar (or I thought so =) with objects, classes, strings and arrays. So I fired the first assignment: implement an interpreter for a programming language each pair of students must design. The language must have the following “feature” set:

Boom! When I told them about the assignment, they were a little bit shocked. They will get in touch with subjects as compilers only at the beginning of the 4th year, so I told them some basic tips about interpreting a language, such as analyzing tokens and using a dictionary to store and manage variables.

After they digested the information, they started designing their languages. They looked like they were having fun doing that. During the last two weeks, they have been working on that assignment. Lots of questions, lots of ideas and approaches. So far, so good.

I don’t really expect them to create a production ready language interpreter. My goal with that task was to enhance their understanding about objects, classes, methods, instantiation, etc. They will empirically learn about a programming language structure. It’s been great so far.

Next week they will present their interpreters. In order to make things even cooler, each pair of students must implement two programs using somebody else’s language. I know this may not be the best approach for teaching OOP/Java, but it’s way better than boring simple tasks.

UPDATE: check the Hacker News thread.