FP /

A JavaScript Mode for the Yi Editor

Deniz Dogan, February 10, 2009

1 Background

There’s an abundance of text editors and IDEs that support editing JavaScript, which have syntax highlighting and have some other nice features. However, existing environments suffer from other problems than pure functionality:

Huge frameworks
High memory usage and generally much more than what the user really needs when programming in a language such as JavaScript.
Example: Eclipse.
Too heavy implementations
This somewhat overlaps with “huge frameworks”, but refers to implementations which are written in lightweight environments, but are still too slow to use on large JavaScript files for different reasons.
Example: js2-mode for GNU Emacs.
Too light implementations
Most environments fall into this category and have very little or no possibility for customization. They are very fast, but too static for a real “power user”.
Example: Notepad++.

This calls for the development of an environment where writing JavaScript code has none of the above listed flaws.

2 Goal

To create a mode for the Yi editor written in Haskell. The JavaScript editing functionality will be provided as a buffer mode, which means that it can be enabled and disabled at will.

The mode should properly implement syntax highlighting and basic error checking and/or warnings, e.g. tell the user when she may have forgotten a semi-colon or if some path of a function will not return, when others will.

I will look for reusable parts and design patterns in the new mode to try to make it easier to develop this kind of Yi mode in the future.

3 Work plan

  • Learn about Yi and specifically how to write modes in it
  • Develop a basic JavaScript parser which does syntax highlighting and syntax error checking
  • Add some convenience functions, such as automatic JSDoc templates for functions, etc.
  • As time permits, add more features to the mode, e.g. making sure that if any path of a function returns, then all of the other paths should also return

4 Structure

A half-time report should be handed in after 8 or 9 weeks to ensure that the documentation work does not lag behind the implementation. The (almost) final report should be handed in after 18 to 19 weeks and before the final oral presentation.

I will be working on the thesis at Chalmers University of Technology, supervised by Jean-Philippe Bernardy. Patrik Jansson will be my examiner. The thesis requires good knowledge in advanced functional programming, specifically Haskell. It also requires understanding about the internals of JavaScript and experience with programming language design and compiler construction.

The thesis should take approximately twenty weeks to complete with a preliminary time frame between February 10 2009 and June 3 2009.