Mystery Languages🔗

What Is This Thread’s Purpose?

The Mystery Language (ML) thread has you understand the design space of specific language features. In an ML assignment, you are given a new language feature’s syntax and a very loose description of it. The assignment will contain (say) three different language variants that contain that new feature, each presented in terms of a black-box implementation of that language.

Each variant will contain this new feature but will define it to behave in a somewhat different way. You will need to use the implementations to explore how the feature varies across the languages and try to pin down the differences precisely. You ultimately produce a classifier: a small set of programs that, collectively, tell the different implementations apart by producing different results under each implementation.

Time

You should spend no more than an hour. It’s much better to spend three 20-minute sessions than one 60-minute one. After each session, step away. Let the problem gestate in your head. After a while you will get some new ideas and angles to try.

After two sessions, if you still feel stuck, come talk to the staff and show them what you’ve tried so far.

Grading Standard

You need to classify most of the languages on most of the assignments. (This has not been a problem for students in the past.) You might not get all of them, but you need to get quite close.

Software

The software is on GitHub. The README provides installation instructions. Please also watch the video linked to the README to get a sense of the mechanics.

Tasks

For each language family, the documentation of available constructs is in the repository’s README. The video shows you how to work with the variants of the strings language.

Here is the list of language families for the whole semester. Check the calendar for out- and in-dates: The arithmetic language is a little tricky. Don’t get demoralized if you can’t figure it out entirely. Remember the grading policy!
  • arithmetic

  • conditionals

  • fun-calls

  • mut-vars

  • mut-structs

  • fields

  • eval-order

In the video, we end up with a small set of programs that can tell all the variants apart. This is the classifier. For each of the language families above, your task is to produce a classifier that distinguishes the variants, akin to that in the video.

Observe that a given program in the classifier set may distinguish only one variant from all the others (just as in the video). When there are more than two variants, it is not always easy to produce a single program that can tell them all apart (i.e., produces a different answer in each variant); nor is it necessary. Sometimes a classifier is much clearer to a reader (like a grader!) if each program distinguishes just one variant; then it has a clear purpose.

Therefore, don’t try to get overly clever. You can if you want for your personal satisfaction, but that doesn’t mean you have to turn that in to us! Or if you do, try to also include simpler, less ambitious programs as well. A classifier does not have to be the minimal set necessary to tell apart the variants.

Finally, we want you to reflect on each language variant, using the following rubric. For each variant, once you’ve figured out its behavior, put it in one of the following four categories, and tell us why:
  • Like and unsurprised: You like this behavior, and you aren’t surprised by it (e.g., adding 1 and 2 produces 3).

  • Dislike and unsurprised: You may not like the behavior, but you’ve gotten used to it by now (usually by exposure during prior programming).

  • Dislike and surprised: Probably true of many mystery languages variants!

  • Like and surprised: You hadn’t previously considered this option, but now that you see it you perhaps wish more languages did it.

Advice

Focus on:
  • The new features that got added in this round. Your solution should incorporate these new features. (Usually there’s only one new feature, but it may have multiple constructs.)

  • The interaction between this new feature and all the ones that are already in the language. Failing to take this into account is a common mistake in language design.

In general, every part of your solution should somehow involve one or more of the new feature’s constructs. Anything else you find may just be an artifact of the implementation.

Submission Format

Please submit as follows:
  1. Submit one file with a suite of tests that differentiates the mystery languages.

  2. Ideally, write a coment (;; for line-comments) about each test so we have a sense of what you are trying to do.

  3. Put your reflection in a block-comment (#| … |#) at the bottom of your file.