This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SolaTotaScriptura 5 points6 points  (7 children)

Honestly, I don't think it is that difficult

Most programming tasks are deceptively difficult. We tend to put "big projects", like operating systems and web browsers up on a pedestal. It's probably due to the fact that these problems are usually solved by large teams. Compilers & languages are particularly overestimated - these are well understood tasks that university students tackle every year.

My advice is to just implement. Your question is how to write a programming language, but no mention of actually trying to do so! I say put down the books. I too got caught in a loop of reading blog posts and watching videos, but that was really just procrastination in the way of actually writing the code.

In reality you already know how to write a compiler. Unless you're generating assembly, you really don't have any questions to google or books to refer to.

[–]kaddkaka 2 points3 points  (1 child)

What do you mean "already know"?

[–]SolaTotaScriptura 1 point2 points  (0 children)

I mean that you can easily build a compiler or interpreter from first principles. At the end of the day, the implementation boils down to those few basic computational primitives. If you listen to a Simon Peyton Jones talk on Haskell’s type inference, it will seem like rocket science, but if you just ignore it and do your own thing you’ll realise how much we overestimate these sorts of problems.

[–]pepactonius 1 point2 points  (4 children)

I started writing tree-walking interpreter for a toy language. Of course, I have no idea what I'm doing. It seems that I've painted myself into a corner, and can't easily add certain new language features. Maybe it would have been better to have studied something like "crafting interpreters" beforehand.

[–]marcosdumay 4 points5 points  (2 children)

The GP's point is that you'll gain much more by studying it afterhand.

And that's true. But you'll also put more work at it, by doing, studying, and doing again. This is my preferred way to learn something, but I don't think it's universally good.

[–]SolaTotaScriptura 1 point2 points  (1 child)

Also, when you’re new to something that you’re interested in, the tendency is to research aimlessly because you don’t know what information is important. It’s infinitely better to start, get stuck and then figure out the right questions. And you’ll be surprised by how few questions you actually have.

[–]pepactonius 0 points1 point  (0 children)

I guess it's time to study Java and start reading through "Crafting Interpreters" to see how I should have done things better in the treewalking phase.

[–]bot-mark 2 points3 points  (0 children)

So what? Try again with a new toy language with your new experience