A haskell interpreter in Javascript

posted in tinyrocket
Published May 19, 2010
Advertisement
The report for my bachelor thesis has just been completed, a Haskell interpreter written i &#106avascript. We were four people working on this project and my main responsibility was to make the parser, this meant stripping comment, applying the layout rules, parsing the actual grammar and generating the abstract syntax tree. Most of the language as it is specified in the Haskell 98 online report can be parsed, but we have not tested everything yet so there are probably a lot of bugs. The layout rules are applied correctly in most cases but some things like let expressions in list comprehensions does not expand correctly as we do not keep track of invalid and valid parsings for let expression, just of matching 'let ... in' expression do get the basic stuff working.<br><br>The simple lexer and the complete parser was made using a parser combinator library called <a href="http://github.com/doublec/jsparse">JSParse </a> and it worked out fine except that it does not keep track of line numbers, columns or which parser that failed so it is really hard to get any good error messages. There were also a couple of bugs in the butnot-parser and in the caching for the choice parser. I managed to fix both of them and the functioning version can be found at our git repository.<br><br>We do not support type classes at the moment but we will most likely fix that in the two coming weeks as we really want them in the final presentation of the project.<br><br>The source code for the whole project can be found at our git repository, feel free to clone it. <a href="http://github.com/johang88/haskellin&#106avascript">http://github.com/johang88/haskellin&#106avascript</a><br><br>I have also put up an online demo at <a href="http://hiji.tinyrocket.se">http://hiji.tinyrocket.se</a> that works in firefox and chrome but internet explorer remains untested. The demo has a small part of the standard prelude library the definition of which can be found here <a href="http://hiji.tinyrocket.se/hs/Prelude.hs">http://hiji.tinyrocket.se/hs/Prelude.hs</a><br><br>Have a nice day<br><br>/ Johan<div> </div>
Previous Entry First post
0 likes 2 comments

Comments

lilljohan
Nice find, looks like i missed that one.
May 29, 2010 10:40 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement