OCaml 4.00.0 on iOS Simulator Is Released

I’ve just released OCamlXSim 3.1.6, a version of OCaml 4.00.0 for building apps to run in the iOS Simulator. Once you build something you like, you can use OCamlXARM to recompile for actual iOS devices and release it in the iTunes App Store.

You can download the compiler as a binary package named ocaml-4.00.0+xsim-3.1.6. You can also build OCamlXSim from sources—instructions are on the Compile OCaml for iOS Simulator page.

OCamlXSim runs on OS X and generates apps for the iOS Simulator using the toolchain that comes with Xcode. The key thing to know about the iOS Simulator is that it’s not the same as OS X. As a result, generating a compiler for the Simulator is very similar to generating one for iOS.

I’d say there were two parts to the project:

It requires some trickery to convince OCaml to be a cross compiler. As with OCamlXARM, what I do is build the compiler 1½ times. The full build creates a cross compiler whose runtime is for OS X. The half build creates an iOS Simulator runtime to be used by the compiled apps.

The i386 code generator of OCaml 4.00.0 works almost without change. I made some very small changes to support 64-bit OS X executables. They’re only about 9% faster, but I found it an interesting challenge to get them working.

OCaml is such a powerful language it gives me ideas for really great apps. Here’s one I just thought of now. You know how there are several popular apps out there that turn your website into articles in a magazine for the iPad?

My idea is that nobody reads magazines any more—what they do is play multiplayer online games. So my app would turn any website into a multiplayer online game. Each page of the website becomes a small town in the game, and each visitor to the website becomes a player in the game. The players travel from town to town battling monsters representing the parts of the website that nobody wants to read (such as sidebars and banner ads). The useful contents of the website would be integrated into the towns (posters on walls, books in the library, menus in the restaurants, movies at the cinema, etc.). Instead of comments on the pages, the players would talk to each other in avatar form.

If you have comments or questions about this idea (or anything else), please leave them below, or email me at jeffsco@psellos.com.

Posted by: Jeffrey

Comments

Please enable JavaScript to view the comments powered by Disqus.

Disqus