From: Justin Bailey Date: 2006-11-10T03:58:45+09:00 Subject: Re: [QUIZ] Bytecode Compiler (#100) On 11/9/06, Ross Bamford wrote: > Aww man, now I'm gonna have to look into Haskell a bit more :) I've been > putting it off for a while, but this is too cool to not have a play > with! Awesome! > > Because I'm currently Haskell-ignorant, however, I don't know how to run > your solution :( . What interpreter (or compiler?) should be used? I > have Hugs installed, but that complains about a "Syntax error in input > (unexpected backslash (lambda))" at line 1. Like someone else pointed out, it's meant to be in a LateX document. It's called "literate coding" and Haskell is the first place I encountered it. The basic idea is you flip the normal source/comments order and make comments the number 1 element in the document. Code is then embedded in \begin{code} & \end{code} directives. (throwaway comment: enabling ruby to run "literate code" would make a cool quiz). Anyways, to run a literate haskell file in hugs, just save it with a "lhs" extension. At least, that works for me in WinHugs. To get a properly formatted version, its available on the web at: http://www.haskell.org/haskellwiki/Haskell_Quiz/Bytecode_Compiler/Solution_Justin_Bailey That version actually works (I'll be resubmitting in a minute). To run all the tests there, type "interpret_tests" after you load the file. Justin p.s. One nice thing about literate haskell is you can copy that entire page (i.e. don't worry about trying to grab only the code), paste it into an lhs file, and run it. Works great on blogs too!