lambdascript
lambdascript copied to clipboard
Ugly prototype language for strongly typed, lazy, purely functional client side web scripting
** NOTE
Lambdascript is, as you've probably figured out by looking at commit statistics, no longer active. It's been superceeded by Haste (https://haste-lang.org) - a compiler that does actual Haskell.
** About
Lambdascript is a prototype language for strongly typed, lazy, purely functional client side web scripting. It provides a basic subset of Haskell's functionality, compiled into Javascript.
Due to its clumsy parser and fugly syntax, the plan is to scrap the thing after it's more or less done (hence, prototype) and rewrite the project using saner tools (BNFC is somewhat suboptimal for anything that's supposed to actually be of any use) to enable some essential features (read: polymorphism) and nicer syntax.
** Building & dependencies
To build the Lambdascript compiler (lsc,) simply run 'make' in the project's root directory; to run the test suite, 'make test' and to build the documentation 'make doc'.
In order to compile LS, you need GHC, BNFC Happy and Alex; the Haskell compiler, parser generator generator, parser generator and lexer generator respectively.
GHC, Happy and Alex are all included in the Haskell platform, available from http://hackage.haskell.org/platform/ and BNFC can be found at http://hackage.haskell.org/package/BNFC.
In order to run the test suite, you need spidermonkey installed. That's also handily available from your package manager if you're on Debian with derivatives, and you might also want to install Haddock (which is also included in the Haskell platform) so you can build the documentation.
On Debian with derivatives, you can install everything you need by issuing:
apt-get install haskell-platform bnfc spidermonkey-bin
** Compiling & running programs
To compile a Lambdascript program into Javascript, run the compiler (lsc) in the root directory of the project with the input file as its only argument: $ ./lsc some/lambdascript/input/file.ls The output file, a.out.js if nothing else is specified, will be created in your working directory.
If you want to run lsc from another directory, you need to specify the path where runtime.js can be found using the -L switch: $ ./some/dir/lsc myfile.ls -Lsome/dir/lib
To run your newly compiled program, include it in an HTML document using the