Write Your Own Language (In Whatever Language You Choose), Pt. 1
doineednumbers (16)

Intro

This is a tutorial on the basic concepts of how to write a language. This won't be too theoretical, but I decided to leave the task of implementing it up to you. For this tutorial, I'm assuming you want to make a language that is novel but still follows some conventions, i.e. variables, statements, etc. The tutorial will guide you through the basic steps of coming up with your own languages.

Part 1

First up: concept. What makes your language your language? You might already know. Here's a tip. A lot of times, you can think of an idea by just saying, 'What if everything was a ___.' For example, shimmerlang (The language me and @beaver700nh are working on) can be summed up as, "What if everything is a function call or a literal?" Try to think of one right now! It might be fun. Once you have an idea, try to think up what that would look like for actual code. Think up a basic syntax, and write some code! Once you've got it, great. Now try to think of some pitfalls. Programming language design is hard, so there will almost certainly be some. For example, in our language, what about variables? If everything is a function call or a literal, and all functions are equal, how can you both define a variable and use it? You could have a function for getting a value based on an identifier, but that would be a pain to type. We eventually settled on $foo for referring to the identifier, and just foo to get the value. And that's the end of Part 1. Leave a comment telling what can be improved.

You are viewing a single comment. View All