Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

★ /prog/ Challenge Vol. 5 ★

Name: Anonymous 2010-06-11 23:51

The challenge suggestion thread was too busy going nowhere, and I feel like writing some code, so here is a /prog/ challenge.

THE CHALLENGE:
Design a toy programming language. You may implement either a compiler or interpreter, and you may write the implementation in any language of your choosing.

Post the source code to your implementation as well as programs in your language to accomplish at least two of the following tasks, plus one ``wild card'' program not listed here.

    • Factorial calculator
    • Fibonacci sequence generator
    • Prime number sieve (e.g. Eratosthenes, Atkin, etc.)
    • fgrep (output lines of input containing a given string)
    • Caesar cipher
    • Simple interactive calculator
    • Tic-tac-toe (AI not required)
    • The game of Nim (http://en.wikipedia.org/wiki/Nim)

Entries must be submitted prior to 2010-06-21 00:00, which gives one full week and two weekends. Judgment will be in three categories: presentation and cleverness of designed language, clarity of implementation, and overall usefulness/entertainment/trolling value of the ``wild card'' program.

Winner will receive ten Susscoins, to be transferred via /prog/mail.

Name: Anonymous 2010-06-12 2:40

>>6
Implementing a Lisp interpreter or compiler is usually easier than in most languages, since you don't have to write your own read (lexer/parser) if you're writing it in Lisp, and since the code is effectively an AST (S-Exp external representation) stored as normal lisp lists (chained cons cell trees) which the language usually provides extensive functions to work with (or if it doesn't, you can easily implement them anyway), you can get right to the task at hand: eval (interpretation) or compile(compilation). Not only that, but such languages are very nice for extending themselves from within via macros due to the language's homoiconic property.

Sadly, I've already written toy interpreters and compilers, so this isn't as interesting of a task, altough it's still fun, but I suppose I lack enough imagination for designing a truly awesome language (I'm sadly content with what I'm currently using, and only have small gripes with the language, which I can fix by writing a few functions/macros). Both interpreters and compilers being rather simple to do in Lisp, altough, real-world compilers are not trivial things, because one has many issues to consider when it comes to optimizations and code transformations one perform, not to mention things like gc's, the runtime, libraries, and so on.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List