everyone should write a programming language

i know, it sounds completely bonkers. ive been toying with the notion for a year or two, and my original thinking on the matter was more of an ideal than a practical thing.

the first question is, “not everyone can write a programming language.” ok, thats not even a question.

not everyone can learn to code, either. wait, yes– everyone (that can learn to read) can learn to code. they might not be able to code in python, or java– but they can definitely code in something. theres absolutely no question. its a matter of making the language simple enough– and thats a hint.

why, why, why, should everyone write a programming language?

because its simply the best way to learn to code. its not the only way! its not always the easiest way– and if learning how to write a programming language isnt helping the student learn to code, then perhaps do something else.

but here i am, explaining to a good friend and fellow blogger who tells me im very good at explaining programming in plain english (thank you, its a huge compliment) that they dont even have to “learn” to code if they can write a programming language–

i know how crazy it sounds. and this is not the first but the second person ive said it to this week. im starting to think i could even be serious.

of course some people need help to learn how to code– and other people need help writing a programming language.

most people would need a lot of help writing a programming language– but then they wouldnt have to learn the language, get it? they would make it up, and thus skip the whole chore of learning it.

now that doesnt mean they would have it memorised– i still have to look up a command in the language i wrote myself, if im not using that command all the time. ive known most of those commands for more than year but hey, theres almost 100 of them. did i make this one with one parameter or two? oh, right, it had two.

what it means is if they made it up, they understand how it will work. steering them towards keeping it simple could be important, though in some cases it could be better to show them how to do things in a more sophisticated way. some people will find it worth the trouble, others will want an easy way (i sure did.)

if creating a language in python (source-to-source compiler or interpreter) i recommend implementing variables, i/o, simple math, loops, conditionals and functions– if its an interpreter you can put all of it in a loop, and have the exit command simply break the loop. that saves having to implement a real loop feature.

for a long time ive wanted to create a programming language designed to make it easy enough for anyone to create their own programming language.

python is the closest thing to that i know, but i mean something easier.

one of the reasons people dont know how easy it is to create a programming language, is that they start with a parser and try to make it sophisticated. as they teach at brown university– dont! start with functions. its what i did to create my language, and i found out its what they teach. you can add a parser later.

a parser can be simple. as they teach at brown, you can build an api and then have more than one parser for different styles of language. i did it that way because i wasnt trying to build a language first, and i didnt know i was going to. thats how easy it was, done that way– “what if i told you… that a language implementation could be written just like any other program?”

parser, scanner, lexer– cut that out! you need to loop through a string of text (possibly containing newlines) and do things based on what the text says. thats your “parser.” stop trying to make an enterprise-grade general purpose language as your first language, and youll have something to show for it a lot sooner.

people often say these days, you need something to accomplish if youre going to learn to code– an app, or a website. it isnt true! you can just practice little tiny snippets that are fun but dont do much thats useful. people learn that way sometimes.

but if youre looking for a thing to accomplish while learning how to code, try a language implementation! seriously– of a very simple language. you can do it! itll be fun. and it will take less time to learn how to code, because youll end up understanding how languages work before youve even learned your first. and yes, at this point i am completely serious.

 

 

Advertisements

6 thoughts on “everyone should write a programming language

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s