Pencil Code Project Ideas

Pre-Project for Await for Beginners

If you're interested in the "await for beginners" project, then submit the following pre-project along with your project proposal. Don't worry if it feels incomplete because you do not have enough time: our goal is to give you a small project that gives you an introduction to the codebase and feel for the project. When you are done, push your changes to your own fork of iced coffeescript on github, and send us the link to your fork.

Pre-Project Description

Create a fork of Iced Coffeescript that adds an "async" keywoard to Coffeescript function definition syntax, and adds a Promise to the generated output. This might be one of the steps in the Summer of Code project, and a good chance for you to try working with the code.

Adding Syntax

The Coffeescript syntax f = (x) -> x*x is compiled to the following Javascript:

f = function(x) {
  return x*x;
}

In this project, you should add async as a keyword to the language; it should only be allowed to use async right before ->:

f = (x) async -> x * x

Internally in the Coffeescript parser, it should create a Code node that has an @isAsync flag set.

Changing the Compiled Code

Then when generating code, you should generate the following code for an async function:

f = function(x) {
  return new Promise(function() {
    return x*x;
  };
}

This altered code generation should not affect non-async functions.

Note that things aren't quite "finished" here - in other words, the Promise should actually interact with a callback. We also have not done the work of importing an implementation of Promise or other things to make the program actually run.

However, that's the limit of this qualifying project. If you choose to do more, that's a bonus.

Tips

Coffeescript is a node-based project. You'll need node.js and npm. Node.js v12 is very new, so if it doesn't work, use v10.

When adding language features, you'll spend most of your time in lexer.cofee, grammar.coffee and nodes.coffee within the codebase.

Summary