• entries
    626
  • comments
    1446
  • views
    1008210

On creating the universe

Sign in to follow this  
ApochPiQ

85 views

I've discovered an interesting truth about creating a programming language: you won't have enough motivation to do it right, unless you already have a program you want to write in that language. It doesn't matter how stupid the program is; if you don't have a problem to solve, the language won't go anywhere.


My first program will be a Sudoku solver, for a few reasons:
  • They're simple and straightforward, but leave room for interesting optimizations and designs

  • The rules can be expressed in a variety of ways which will force me to think about how domain knowledge is represented in the language

  • I've been wanting to write one for the hell of it for a while anyways

  • Someone just gave me a large book of Sudoku puzzles, and I can't be bothered to finish them by hand; just writing a program to finish them seems a bit like cheating, so I'll create a programming language to write a program to solve them. That's about fair I think.



(Yes, fans and enthusiasts, this means Epoch is officially back in action - please try to contain your excitement. I don't want to get any unbridled joy on my shirt.)
Sign in to follow this  


5 Comments


Recommended Comments

I was looking at the maths of sudoku recently. Alot of it is based on permutation groups, similar to, but much more advanced than the stuff im playing with in haskell and nemerle.

Hope to hear more on this. But these journals are a dead place. Few interesting discussions ever arise so I am skeptical.

Share this comment


Link to comment
Yay its finally back! But yea ive came to realize its hard to code a language without having something to program to fit the goals of the language around. I just recently realized that also applies to game engines but its all a learning experience!

Cant wait to see how it looks and dont be afraid to do things differently with this language just because wide used languages dont, do what WORKS!

Share this comment


Link to comment
Good choice of puzzle...

I was sitting on the train on the way to work last year and tried one of those Sudoko puzzles. Got bored and instead worked out a (probably inefficient) algorithm to solve all sudoko's and decided I never needed to do them by hand again. Kudos for going one step further and writing the language to solve the problem a well [lol]

Jack

Share this comment


Link to comment
I've been scribbling around with the syntax and managed to write out the complete rules for verifying a board; assuming the language only provides arbitrary matrix and array types, the whole thing is about 14 lines of code. There's still a bit of verbosity and a lot of rough edges, but that's quite a bit cleaner than I could manage to do in, say, C++. (Now, I'm sort of cheating a bit by assuming that the language and/or library has built-in map and reduce functions, but still.)

I expect that the syntax is going to go through a lot of refinement before it's ready for even early public display; and even then, I expect that with general input (i.e. feedback from people smarter than me) it will be refined quite a bit more. At the moment it's a sort of Frankenstein conglomeration of LISP and Ocaml [grin]

At the moment it looks like the type system is going to be the most difficult part to sort out, syntax-wise. I want a robust statically typed system, but with inference and rich conversion semantics - i.e. variables are always statically and strongly typed, but conversion operators are plentiful, so the language can look dynamic and/or weakly typed without actually sacrificing the advantages of strong, static typing. Of course I'm also wanting to avoid manifest typing as much as possible, and these concerns are naturally tricky to balance.

Anyways, more updates as things continue to progress (which will probably be slow, considering that this is a pretty low-priority project). The next big step is to decide on an algorithm for actually finding the solution. I'm thinking of just doing a brute-force version first and then working on a parser and interpreter so I can get things running; we'll see how it goes from there.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now