WTF: A DSL for hand-written 4-function calculators

In one sense, this is light enough that I feel bad posting it to LtU. In another, though, it's entirely relevant: this guy started out inventing a DSL for pen-strokes, combinations of them, and relations between these combinations, and ended up with a simple OCR-based 4-function calculator. This was one of the cleverest bits of just-because programming language work and contrived abstraction that I've seen in a long time. Sample:

   Zero is
          a large circle

     One is
          either
               a long vertical line
          or
               a long vertical line
               a very small slash line
               top of first joins top of second

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

That's neat.

And he wrote his four function calculator with 4000 lines of C++.

I wonder if the "OMGWTF Programming Contest" is going to become a yearly event, like the ICFP Programming Contest?