before you post one of the obvious excuses not to, know that i have a list of those excuses and retorts to each one written-- its one thing if you dont want to create a language-- its another thing if you think theres a GOOD REASON not to. (at least, i dont agree.)
but before that gets complicated, here is my usual spiel (i wrote this today.) and i do recommend this to everyone, actually.
(one person i said this to used to debate with me all the time about it, until i pointed out that he had already written a macro language. he hadnt realised this, and then he wrote another language for a contest i started. he had never deliberately written a language before. and he implemented these languages in smallbasic. because... why not?)
programming languages for all sorts of things
what do musical notation and written lyrics have in common with programming languages? a lot.
standard musical notation can be considered a series of output statements. when expressed instead as a piano roll, music is as much like a punchtape program as it is a recording. (the other way around, you can store a basic program on a cassette tape.)
lyrics often include loops: a certain section will say at the bottom: repeat 4x, or repeat 2x– hymnals will sometimes include all of the above: sheet music, lyrics and loops.
then there are other forms of notation such as clefs and articulations, which are much like metacommands or parameters in programming.
but theres no law that says you have to use sheet music. in fact you might manage to design simple instructions for the computer that can tell it to do music for you. the play macro is an example of simple musical notation, closer to guitar tabs than sheet music.
sheet music certainly has its advantages. it goes up and down as the notes do. it lets you visualise music rather than simply read it. but it is a form of written language.
a programming language is really just a terse, formal system for describing computer actions. it doesnt even have to be terse, though you generally want it to be so there is less to type and more will fit on the screen (or paper.) in some instances, you want to spell things out:
* print
* system
and in other instances, you want to abbreviate:
* cls (it means: clear the screen.)
if you want to help design programming languages, i wish more people would imagine a few commands that describe things the computer can do. im still working on a book about this, but its the idea i want to get out to people, more than the book. the book just explains the idea more.
a command is just a word. sometimes it has parameters, which are just details added to the word. for example:
* print
puts text on the screen. used by itself in some languages (including python,) it will simply add a blank line to the screen– effectively moving down one line. but the obvious parameter for print is to have a parameter that says what should be output:
* print"hello, world!"
the quotes are not always required. it makes sense to have quotes, because sooner or later youll want to be able to say"the thing to process starts with this quote, up until the second." but if you always put one command per line (not always great to use) and if you always put the"string" (a series of text characters, like"hello, world!") as the final parameter, you can arrange your language like this:
* print hello, world!
as soon as the print statement is encountered, the language could assume the rest of the line is text to be printed. this isnt how it usually works, but it can work this way.
here is a hint: any time you click on a button, click on a text link, or click on a program icon, you are doing something that either could be turned into a command, or already has one. for example, the pale moon browser already has a command that starts pale moon as a command. the command is called: palemoon (all one word.)
is there a point to having palemoon as a command? yes. it can take a web address as a parameter:
palemoon
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://antix.freeforums.org"
linktext was:"https://antix.freeforums.org"
====================================
you can then write a"script" (an often simple, usually interpreted program) that contains multiple instances of the palemoon command, so that it opens several websites at once.
you get the idea. once something is a command, you can do all kinds of things automatically, like:
* play music– either by scripting notes in a song or songs in a list
* load several files and/or applications (this is a common use.)
* get information from online and compile into your own personal"offline" homepage
* add quick updates to a site or blog automatically
there are already languages to do these things and more– why make new ones?
simply put: you can teach yourself how code works by inventing your own commands (and borrowing others.) how do you invent a command?
* decide what you want it to do
* give it a name
* decide on parameters; how many, whether they use strings or numeric (number) values, etc.
the most useful step after this is to actually create a function that does the work of that command, but thats something you can get help with.
i would like more"everyday people" (including people that dont code yet) and teachers who do code or would like to code, developing and describing their own commands. i believe this will lead to better coding education, and better languages for education (and more interesting languages in general.)
its as easy as fan-fiction. it kind of is like fan-fiction, except for programming:
"theres a command that makes things uppercase, and a command that prints. why cant we have a print-upper-case command?"
"you can."
"why dont more languages have one?"
"because print is more universally useful if it leaves that to ucase or upper, and ucase or upper are more useful if they can be combined with other commands on the fly."
fig doesnt have a print-upper-case command, but its commands can be used one-after-another in a pretty cool way (inspired by unix pipes)
now"hello, world" ucase print
instead of saying print-upper-case"hello, world", we just say:
"hello, world" ucase print
and since fig goes left to right, it knows first to set the variable to"hello, world" then to make it upper case, then to print it.
when your language works like that, you really dont need a"print-upper-case" when you can use"ucase print" even though they are two commands. the advantage/convenience is roughly the same already.
but, you can still create a print-upper-case command. lets call it print_upper_case instead, for now:
function print_upper_case what
now what ucase print
fig
there you go, a print_upper_case command. fig is based on python, and python wont like the dashes in print-upper-case. but you can still create a language that stays ahead of that, and turns the dashes to underscores before python can complain about it.
therefore my advice is: use your imagination, and worry later about whether your imaginary language is possible to create. chances are, a lot or even most of it probably is.
i am really serious about teachers helping to design new languages for teaching programming. i think that could dramatically increase the friendliness of languages, in some examples. but why should teachers have all the fun? you could do it, too.
(copy freely.)
* license: creative commons cc0 1.0 (public domain)
*
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://creativecommons.org/publicdomain/zero/1.0/"
linktext was:"http://creativecommons.org/publicdomain/zero/1.0/"
====================================
3 posts
• Page 1 of 1
-
Posts: 148
- Joined: 29 Jun 2017
-
Posts: 5
- Joined: 13 Jan 2017
#2
Alright, I'm intrigued. Your post just made several lights go on in my noggin.
Could you post some links and/or book suggestions?
I have always wanted to get into programming, but it never really made sense to me.
COMMON LISP: A Gentle Introduction
to Symbolic Computation is the first book on programming that made any sense to me because it starts"at the beginning."
Could you post some links and/or book suggestions?
I have always wanted to get into programming, but it never really made sense to me.
COMMON LISP: A Gentle Introduction
to Symbolic Computation is the first book on programming that made any sense to me because it starts"at the beginning."
-
Posts: 148
- Joined: 29 Jun 2017
#3
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://www.pdfhost.net/index.php?Action=Download&File=5146d3216a58bca27e58c0debec54034"
linktext was:"https://www.pdfhost.net/index.php?Actio ... debec54034"
====================================
since im the author (free download-- public domain-- just skip the terrible introduction and go right to"variables" on page 8 of the pdf) you might get farther asking me questions.
a video, if you prefer:
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://upload.wikimedia.org/wikipedia/commons/a/a8/Fig-Coding-Tutorial.webm"
linktext was:"https://upload.wikimedia.org/wikipedia/ ... orial.webm"
====================================
lets sum up the kind of coding youre most likely to become interested in...
everything is a number to the computer. everything.
you put certain numbers at certain numeric addresses to do anything on a computer-- but wait...
people take those numbers and create languages that are"alpha-numeric" to make it easier to code.
so instead of plugging codes for the letters"hello world" into memory then copying it to the screen, you can just say:
print"hello world."
and its done.
when i teach programming, the 7 most important concepts (others are optional) are:
* variables (give names to pieces of data, then reuse them.)
* input (data goes from the computer/devices to the program itself)
* output (data goes from the program to the computer/devices)
* basic math (addition, subtraction, division, multiplication)
* loops (running the same part of code an x number of times before going on to more code)
* conditionals (running a section of code only if certain values are in certain ranges)
* functions (building small paragraphs of commands/code into custom-made commands, and reusing)
thats 7 things. but those 7 things summarise most of what ive done with coding, including writing a programming language.
those are also listed roughly in terms of complexity. for example, setting a variable is this easy:
p ="hello, world"
there, now the variable"p" holds the string data"hello, world."
add an output command and it can go to the screen:
p ="hello, world" ; print
bash is a little trickier, but antix includes bash (most gnu/linux distros do.)
same code in bash:
p="hello, world" ; echo $p
"echo" in bash is roughly the same command as"print" in fig.
im always happy to teach someone more about code, if youre interested. im not the only one here that might offer, though im happy to get you started and/or take you through more of it.
...as for this topic, which is about teaching yourself to code by inventing your own programming language...
im happy to walk you through that, too. im working on a very informal book about it, but the book is just there to support the concept and talk about ways a non-coder can invent their own programming language.
by the time youve invented your own language, youre already very close to understanding many things about code. i wouldnt compare it to learning to drive by building a car. (a critic might.)
any questions you have i am happy to try to answer.
incidentally, the code below this line is bash code, not fig. its code i use to search through all the files in antix, while skipping a few im less interested in. you can also use the locate command for that (but i dont prefer it.)
book, per your request:I have always wanted to get into programming, but it never really made sense to me.
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://www.pdfhost.net/index.php?Action=Download&File=5146d3216a58bca27e58c0debec54034"
linktext was:"https://www.pdfhost.net/index.php?Actio ... debec54034"
====================================
since im the author (free download-- public domain-- just skip the terrible introduction and go right to"variables" on page 8 of the pdf) you might get farther asking me questions.
a video, if you prefer:
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://upload.wikimedia.org/wikipedia/commons/a/a8/Fig-Coding-Tutorial.webm"
linktext was:"https://upload.wikimedia.org/wikipedia/ ... orial.webm"
====================================
lets sum up the kind of coding youre most likely to become interested in...
everything is a number to the computer. everything.
you put certain numbers at certain numeric addresses to do anything on a computer-- but wait...
people take those numbers and create languages that are"alpha-numeric" to make it easier to code.
so instead of plugging codes for the letters"hello world" into memory then copying it to the screen, you can just say:
print"hello world."
and its done.
when i teach programming, the 7 most important concepts (others are optional) are:
* variables (give names to pieces of data, then reuse them.)
* input (data goes from the computer/devices to the program itself)
* output (data goes from the program to the computer/devices)
* basic math (addition, subtraction, division, multiplication)
* loops (running the same part of code an x number of times before going on to more code)
* conditionals (running a section of code only if certain values are in certain ranges)
* functions (building small paragraphs of commands/code into custom-made commands, and reusing)
thats 7 things. but those 7 things summarise most of what ive done with coding, including writing a programming language.
those are also listed roughly in terms of complexity. for example, setting a variable is this easy:
p ="hello, world"
there, now the variable"p" holds the string data"hello, world."
add an output command and it can go to the screen:
p ="hello, world" ; print
bash is a little trickier, but antix includes bash (most gnu/linux distros do.)
same code in bash:
p="hello, world" ; echo $p
"echo" in bash is roughly the same command as"print" in fig.
im always happy to teach someone more about code, if youre interested. im not the only one here that might offer, though im happy to get you started and/or take you through more of it.
...as for this topic, which is about teaching yourself to code by inventing your own programming language...
im happy to walk you through that, too. im working on a very informal book about it, but the book is just there to support the concept and talk about ways a non-coder can invent their own programming language.
by the time youve invented your own language, youre already very close to understanding many things about code. i wouldnt compare it to learning to drive by building a car. (a critic might.)
any questions you have i am happy to try to answer.
incidentally, the code below this line is bash code, not fig. its code i use to search through all the files in antix, while skipping a few im less interested in. you can also use the locate command for that (but i dont prefer it.)