yca2swf? was coreFunc has extra argument

Hi, Jeremy shaw wrote: and when the 'compiler' calls main it actually passes in a World value. (Or at least, in my *yca2swf* compiler I believe I do). Jeremy: could you please elaborate on this? It doesn't even google. Does this involve actionscript in any way (but I may ask mistakenly as I am not much familiar with shockwave/adobe stuff)? -- Dimitry Golubovsky Anywhere on the Web

At Tue, 4 Mar 2008 11:38:01 -0500, Dimitry Golubovsky wrote:
Hi,
Jeremy: could you please elaborate on this? It doesn't even google.
Does this involve actionscript in any way (but I may ask mistakenly as I am not much familiar with shockwave/adobe stuff)?
I have been working a Haskell->shockwave flash compiler for a while. Currently I use yhc to compile Haskell->.yca, and then I have another program that compiles the yca->swf. As of a few days ago, it kind of works. However it is not yet very useful because the FFI is extremely limited (and broken). I am working on improving the FFI now so that it can create objects and invoke methods on objects and marshall types between Haskell and the flash virtual machine (for example, Bool). I believe all you need to do is: darcs get http://www.n-heptane.com/nhlab/repos/haskell-swf runhaskell Setup.hs configure && runhaskell Setup.hs build && sudo runhaskell Setup.hs install then: darcs get http://www.n-heptane.com/nhlab/repos/yhc/ run scons to build the yhc binary cd src/translator/avm2/ edit the YHC_BASE_PATH in Makefile run 'make' to generate test.swf from SimpleTest.hs Alternatively you can just point your browser at: http://seereason.com/~jeremy/test.swf Which is the output from the program, swfMain :: IO () swfMain = do putChr 'h' putChr 'i' The top box is 'stdout', the bottom box is debug information. As you can see, it currently takes a lot of work to print 'hi' :) j. ps. One thing you should definitely *not* do, I repeat, *not* do is attempt to look at the source code for the yca2swf compiler. It is a horrible mess and full of comments that are completely wrong. :) The yca2swf compiler is based on the STG machine paper -- which is also not really a good way to do it. My plan is to finish the FFI stuff for the current version, and then start over.

Jeremy Shaw wrote:
The yca2swf compiler is based on the STG machine paper -- which is also not really a good way to do it. My plan is to finish the FFI stuff for the current version, and then start over.
*gulp* I'm guessing you mean "Implementing lazy functional languages on stock hardware". That's gonna be pretty painful. My recommendation is to read this book, it's out of print so it's available online for free: http://research.microsoft.com/~simonpj/Papers/pj-lester-book/ Read particularly the chapters on the G-Machine. The Yhc interpreter is based on a slightly modified G-Machine design. For a more in depth discussion you could use this other book, also out of print and available online: http://research.microsoft.com/~simonpj/papers/slpj-book-1987/index.htm Though I found the first book sufficient for most purposes. You can also look at how Yhc does it. The Yhc wiki has lots on how Yhc is implemented. http://www.haskell.org/haskellwiki/Yhc/RTS The G-Machine is a bit unusual as virtual machines go, so it's well worth understanding exactly how it works. Of course you'll need to adapt it to the oddities of the actionscript virtual machine thingy :) Have fun :) Tom
participants (3)
-
Dimitry Golubovsky
-
Jeremy Shaw
-
Tom Shackell