3 ms·
Nice. Is it possible to cross-compile it to other languages?
by itmag 15y ago
Nice. Is it possible to cross-compile it to other languages?
- gcr 15y agoI... don't think so. Not in the way you're thinking of, anyway. In this BrainF example, your language "compiles" (translates, really) to Racket expressions; then, the Racket VM "compiles" it to Racket bytecode just before running it. For something as simple as BrainF, it's not hard to write your own translator. Just replace every [ with while (* ptr) {, replace + with (* ptr)++; replace < with ptr--; and so on. Then it's essentially a BrainF-to-C translator. It's not so simple for racket in the general case. Danny Yoo is working on "Whalesong", a javascript interpreter that interprets racket bytecode so you can run racket in your web browser. http://hashcollision.org/whalesong/ http://hashcollision.org/whalesong/ It's still not a Racket->Javascript translator though. I'm not aware of similar projects for other languages. (Edit: formatting ate my asterisks)