22

On the lolcode website I saw many references to various lolcode interpreters. But is there a lolcode compiler for the x86 or x86_64 architecture, that compiles directly to native machine code?

I have looked at several interpreter implementations, including Lci, lolcode.net (compiler to .NET), and lolcode interpreters in Python, Java and JavaScript. None of these do what I want.

Part of my rationale for asking is that if no such compiler exists, I may be interested in working on one, possibly by writing a LOLCODE -> C translator, and then leveraging a C compiler such as GCC to target native architectures.

ire_and_curses
  • 68,372
  • 23
  • 116
  • 141
DejanLekic
  • 18,787
  • 4
  • 46
  • 77
  • 4
    Why the downvote? Lolcode may seem like a joke to you (whoever downvoted), but it is a programming language with nearly 20 implementations! – DejanLekic Nov 24 '11 at 21:23
  • There is a compiler to .NET on the implementation list, but you are looking for a compiler to machine code, right? A lolcode interpreter in lolcode is missing too :) – Patrick Nov 24 '11 at 22:16
  • I am aware of the compiler which targets the .NET. :) – DejanLekic Nov 24 '11 at 23:27
  • 24
    The fact that lolcode is a joke, doesn't make it any less a programming language. On-topic, IMO. – Goran Jovic Dec 02 '11 at 11:38
  • @Patrick, the C interpreter for LOLCODE is pretty good. – DejanLekic Dec 02 '11 at 11:40
  • @GoranJovic: that is exactly my point. – DejanLekic Dec 02 '11 at 12:02
  • 2
    @DejanLekic: Can you show us what *you* have found out so far? – Sebastian Mach Dec 02 '11 at 12:16
  • phresnel, I've found interpreters in all mainstream languages, compiler to .NET, but no compiler native code. I was thinking that perhaps the best would be to do a LOLCODE -> C translator, and then use a C compiler like GCC to target anything... – DejanLekic Dec 02 '11 at 12:32
  • @phresnel: I would not ask this question on StackOverflow if a search engine gave me the answer... The second reason I ask this question is a research - if there are no compilers, I may decide to work on one. – DejanLekic Dec 02 '11 at 13:26
  • @DejanLekic: Mention what you have tried. Or do you want us to make the same mistakes? It is not mockery, rather we want you to help us :) – Sebastian Mach Dec 02 '11 at 13:29
  • The first (and the best) I tried is Lci ( http://www.icanhaslolcode.org/ ). I also tried the lolcode.net (.NET), lolcode interpreter in Python, Java and JavaScript. – DejanLekic Dec 02 '11 at 13:37
  • Just as a suggestion if you eventually decide to write your own compiler: Try out LLVM, it makes writing compilers for new languages so easy - there's even a tutorial somewhere on the site on how to build a mini-compiler. Definitively sounds like fun! – zerm Dec 02 '11 at 16:49
  • 1
    http://lolcode.com/implementations/implementations That's your best resource. There's a 1.2 Java implementation that has a heck of a lot of functionality (and, being Java, would use x64 if your JVM is there). I actually used it for a heck of a lot of scripting and it was relatively elegant (and fun). Stupidly, LOL -> OpenJDK (GNU) -> Native actually works. – Daniel B. Chapman Dec 05 '11 at 03:07

1 Answers1

8

Apparently there were at least two attempts of translating lolcode to LLVM bytecode

Having LLVM bytecode you can easily translate it into optimised target architecture's assembly by using for example llc and get native binaries out of it.

As a matter of fact, you can also generate JavaScript using this approach.

Have fun.

Jan
  • 11,636
  • 38
  • 47