

JSHC: a haskell compiler/interpreter written entirely in javascript - mcantelon
https://github.com/evilcandybag/JSHC

======
Chirono
It looks like this is for a Bachelor's degree at the university of Gothenburg.
From the abstract of the project report[1]:

 _Development of large web based applications using scripting languages such
as PHP or JavaScript can be difficult given the lack of static type checking
and abstraction through module systems in many such languages. We argue that
static type checking and module systems can help programmers avoid common
errors when developing large web appli- cations. The literature indicates that
adding an extra layer of abstraction on top of the scripting languages that
provides these features can be a solution to this problem. We suggest a
solution where the statically typed functional language Haskell is com- piled
to JavaScript code, enabling programmers to create web applications in a
modular and type safe environment.

An implementation of a compiler, supporting compilation of a subset Haskell to
JavaScript, JSHC, is presented as a proof of concept. The compiler has a
graphical interface in the form of an Emacs-like text editor extended to
contain an interpreter terminal, to allow execution of arbitrary expressions.
To allow for client-side compilation, the compiler is written entirely in
JavaScript. A comparison between JSHC and another JavaScript based Haskell
implementation is presented, as well as some unexpected issues with the
Haskell specification._

[1]
[https://github.com/evilcandybag/JSHC/blob/master/report/proj...](https://github.com/evilcandybag/JSHC/blob/master/report/project-
report-2011-06-03.pdf?raw=true)

~~~
nxn
yhc, uhc, hjs, ghcjs,"haskellinjavascript", jshc, haskell -> llvm ->
emscripten, etc, etc

In fact I wanted to start my own -- except I don't have a single clue of how
to even go about doing something like that. Though now that I think about it,
I wish all the effort was put into a single project that wouldn't die off
within a few months of going public.

~~~
Chirono
If you want to give something like that a go, then a good place to start is by
modifying or adding to an existing compiler. It will give you some exposure to
other peoples code too and a good place to start - you'll always have
something with tangible results.

Either that or read op on writing interpreters. They can be amazingly
simple...

Interestingly, the report mentions that none of the authors knew Javascript
before they started.

