A modern, C# style language that compiles to JavaScript.

Prefix is a C# style language that compiles into JavaScript, bringing many of the features of C# to web development but none of the bloat.

Prefix supports static and dynamic typing, global scope code, classes, interfaces, constructors, properties, inheritance, overloading, virtual methods and properties, static members, indexers, enums, generics, arrays, delegates, anonymous functions, lambda expressions, dynamic casting, inline JavaScript, nested classes, namespaces, read-only fields, variadic functions, default parameter values, type inference and more...
Static and Dynamic
Since Prefix supports both static and dynamic typing you can use dynamic typing to directly call external JavaScript libraries (eg: jQuery, Node.JS etc...) and static typing for rigorous compile time type checking of your own internal code.
The Prefix compiler performs code path analysis generating warnings on unused variables, errors on use of an uninitialized variable, unreachable code detection and more.
The maximum supporting runtime overhead of Prefix compiled code is about 2K of minified JavaScript, but... the compiler only generates what's needed so sometimes there will be no additional supporting code.
Prefix generates well formatted code that is easily recognizable as your original code - making debugging easier. It uses best practice techniques techniques and performs as well as hand coded JavaScript code.
Simple Tooling
The Prefix compiler is supplied as a simple command line utility. Give it one or more input files and it will spit out a single self contained JavaScript file.

Show Me the Code!

The giant page of samples shows Prefix code and the corresponding generated JavaScript.

For more information:

  • Read the blog posts.
  • If you're slightly insane, you might like results of the latest set of unit tests.


Prefix is currently under active development and should be available for non-production testing use soon.

The initial version will be available as a .NET/Mono command line executable (it currently runs on Windows, OS-X and Linux). The plan is for Prefix to eventually be able to compile itself - at which point it will be available as a JavaScript module running under Node.JS

If you're interested in testing it or have a question or suggestion you can find me me on Twitter or contact me here.