8

I've created an experimental toy programming language with a (now) working interpreter. It is turing-complete and has a pretty low-level instruction set.

Even if everything takes four to six times more code and time than in PHP, Python or Ruby I still love programming all kinds of things in it.

So I got the "basic" things that are written in many languages working:

  • Hello World
  • Input -> Output
  • Countdowns (not as easy as you think as there are no loops)
  • Factorials
  • Array emulation
  • 99 Bottles of Beer (simple, wrong inflection)
  • 99 Bottles of Beer (canonical)
  • Collatz conjecture

  • Quine (that was a fun one!)

  • Brainf*ck interpreter (To proof turing-completeness, made me happy)

So I implemented all of the above examples because:

  • They all used many different aspects of the language
  • They are pretty interesting
  • They don't take hours to write

Now my problem is: I've run out of ideas! I don't find any more examples of what problems I could solve using my language.

  • Do you have any programming problems which fit into some of the criteria above for me to work out?
  • You could get some more responses if you revise your title to something better descriptive of what you are asking. Perhaps something like "Can you help me think of problems for my programming language?" – rlb.usa Apr 08 '10 at 17:17
  • "Conjatz conjecture", don't you mean "Collatz conjecture", http://en.wikipedia.org/wiki/Collatz_conjecture ? – Pindatjuh Apr 08 '10 at 18:26

12 Answers12

4

Try things from Project Euler - these puzzles are always good for testing out new languages.

Callum Rogers
  • 15,630
  • 17
  • 67
  • 90
3

Implement a compiler (to any language you know) for your language, in the language itself.

Jakob
  • 24,154
  • 8
  • 46
  • 57
  • Though requires a lot of understanding and if the language is not easily compilable, then it fails "They don't take hours to write". – Pindatjuh Apr 08 '10 at 18:28
  • 1
    They __do__ take hours to write, unless the languages are very simple. – Callum Rogers Apr 08 '10 at 18:30
  • Oh, I actually missed that part of the posters requirements. Lets hope it's a really simple language then (or that the poster's up for a bigger challenge) :) – Jakob Apr 08 '10 at 18:36
  • I would really love writing a compiler in it that translates code in my language to assembler - would be pretty hard, though as my language has built-in dynamic typing and string support. – I can't tell you my name. Apr 08 '10 at 18:57
  • Well, assembler is kind of overkill. Translate it into something that's not so far from your own language to begin with (which means something with dynamic typing and string support then). And even if you wanted to go low-level, C (or rather C--) would be a lot more portable than assembler. But that can wait until your language is the next Ruby I suppose :) – Jakob Apr 08 '10 at 21:11
2

try implementing various types sorts and searches, using arrays and then pointers.

Sorting Algorithm
Search Algorithm

KM.
  • 101,727
  • 34
  • 178
  • 212
2

Something recursive perhaps?

I've got two toy languages of my own. I've done some of what you described. Another thing I did was try to print out the Fibonacci Sequence. One more thing you can do is write a program that checks to see if a number is prime.

Do you have a link to your language? I'd like to check it out!

Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
1

Rather than more things to do in that toy language, I'd think hard about implementing a language that's somewhat more complete and useful. In particular, spend some time thinking about the things you dislike about other languages, and see if you can't improve them.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
1

You could consider implementing the tests for the "Shootout".

Pete
  • 11,313
  • 4
  • 43
  • 54
0

Try to implement something real. For example web based mail client. Do just abstract task is boaring.

0

How about canonical data structures and algorithms? Or semi-canonical? For intance, I always wanted to implement associative array based on radix trie. That looks fun.

akalenuk
  • 3,815
  • 4
  • 34
  • 56
0

This could be a good application of the items you find at http://codekata.pragprog.com/2007/01/code_kata_backg.html#more

John Fisher
  • 22,355
  • 2
  • 39
  • 64
0

After you finish with writing a bunch of short applications it might be interesting to write a simple server. A lot of topics come up with servers that would help you identify if your language can address things like UDP/TCP, threading, queues, security, etc.

Adam
  • 3,063
  • 5
  • 35
  • 49
  • I would not advice this for a toy language. It's very domain specific and it doesn't help you add language features. – Pindatjuh Apr 08 '10 at 18:27
  • @pindatjuh: I respectfully disagree. I actually think there would be a large amount of features that could be created in the process of creating a toy server (note - not intended for any actual full blown production servers). Just off the top of my head the developer could add support for i/o, threading, data structures, etc. It all just depends on how far down this path he/she wants to go. I do agree that it might be a little much, but it would help him/her learn all the issues that come up with all that low level stuff. – Adam Apr 08 '10 at 20:40
0

Check out the RubyQuiz site. Plenty of silly little things you could do to test out your language.

bergyman
  • 4,480
  • 3
  • 23
  • 32
0

You could add support for arbitrary precision arithmetic by either writing it as a module for your language in your language or as a first class language construct.

gradbot
  • 13,732
  • 5
  • 36
  • 69