GSoC/GCI Archive
Google Code-in 2011 Parrot Foundation

Document expression-less switch statement in Winxed

completed by: Aleksandar

mentors: Andrew Whitworth

Task Description

Most programmers are familiar with the switch/case statement from C and C-like languages. Winxed provides a version of this same syntax as well. The Winxed version does not require an expression in the switch statement. For instance, you can write:

switch {
    case a == b: ...
    case a == 4: ...
}

This version of the syntax, the "expression-less switch" is not well documented or tested. Do the following:

  1. Look for examples of the expression-less switch statement. There are several examples in the Winxed compiler source (winxedst1.winxed)
  2. Add at least two tests to the Winxed compiler test suite for the expression-less switch statement. 
  3. Add a description and code examples for regular switch and expression-less switch syntaxes to the documentation on the Rosella website.

Steps To Complete This Task

  1. Create a fork of winxed.git on github.com
  2. Add tests for expression-less switch syntax to a new test file t/basic/04switch.t
  3. Create a Github pull request (button on the upper right of your fork) to have your changes incorporated into the Winxed master repository
  4. Create a fork of Rosella.git on github.com
  5. Check out the gh-pages branch
  6. Add documentation for switch statements to winxed/syntaxandtypes.md, following existing formatting cues
  7. Create a Github pull request (button on the upper right of your fork) to have your changes incorporated into the Rosella master repository

Benefits

  1. Adding tests for existing features helps to ensure that they work as expected and they do not break over time.
  2. Adding documentation for existing features helps to teach users about them, and helps users to start using them.

Requirements

  1. Familiarity with Java, C# and/or JavaScript (Winxed is based on these)

Additional Links