18
you are viewing a single comment's thread
view the rest of the comments
[-] jeena@jemmy.jeena.net 1 points 1 year ago

At university the by far coolest and most fun course was compiler construction. We had to write something which would compile a small subset of Java (Javalette) into the Java Virtual Machine instruction set.

I wrote my compiler in Haskell because it seemed that it'd be much less hassle compared to do it in a object oriented or procedual language.

It ain't pretty but it's honest work: https://github.com/jeena/CC/blob/master/Compiler.hs

[-] cashews_win@lemmy.world 0 points 1 year ago

I wrote my compiler in Haskell because it seemed that it’d be much less hassle compared to do it in a object oriented or procedual language.

That is not a feeling I'd associate with Haskell!!

[-] jeena@jemmy.jeena.net 1 points 1 year ago

But it definitely was, oh and when you compared the results, I don't remember the exact number anymore but compared to especially the solutions in Java and C++ the haskell ones used around 1/10 of the lines of code to solve this particular problem. Because in the end this problem really has a recursive nature.

this post was submitted on 26 Jun 2023
18 points (100.0% liked)

Programmer Humor

32443 readers
836 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS