I've created some compiler related tasks on RosettaCode. The goal is to create a simple compiler in small pieces: Scanner, Parser, Code Generator, and Virtual Machine Interpreter tasks have been created.<p><pre><code> Scanner
http://rosettacode.org/wiki/Compiler/lexical_analyzer
Parser
http://rosettacode.org/wiki/Compiler/syntax_analyzer
Code Generator
http://rosettacode.org/wiki/Compiler/code_generator
Virtual Machine Interpreter
http://rosettacode.org/wiki/Compiler/virtual_machine_interpreter
</code></pre>
In order to keep the actual solutions smallish, the language is necessarily very simple - a Tiny (mostly) subset of C, with only integer variables.<p><pre><code> /*
Simple prime number generator
*/
count = 1;
n = 1;
limit = 100;
while (n < limit) {
k=3;
p=1;
n=n+2;
while ((k*k<=n) && (p)) {
p=n/k*k!=n;
k=k+2;
}
if (p) {
print(n, " is prime\n");
count = count + 1;
}
}
print("Total primes found: ", count, "\n");
</code></pre>
There are currently implementations of all the main tasks in Algol W, AWK, C, Phix, Python and Scheme.<p>I'm especially interested in seeing implementations in other languages, including Java, C++, C#, Haskell, OCaml, Clojure, Racket, Erlang, Pascal, Nim, PHP, Javascript, Julia, F# and any others you can think of.