programming language design for true beginners

i prefer python for this, but sb is my favourite basic dialect and probably my first choice after python...

# simple programming language in smallbasic

# public domain 2017 mn

# "the moment learning actually begins is not when you read the spec and not when you take the examples out the spec [but] when you ask: 'i wonder...'"

# "the documentations going to run for paaaages, and thats how you know its a 'real' language!"

# "inside every large language theres a small language" https://www.youtube.com/watch?v=3N__tvmZrzc

program = "CLS:COLOUR10:PRINThello there:SLEEP5:cls:COLOUR14:PRINThow are you:SLEEP15"

pl = len(program) + 1
buf = ""

for p = 1 to pl
t = mid(program + ":", p, 1)
if t = ":":
if left(lbuf, 3) = "cls":
cls

elif left(lbuf, 5) = "color":
color val(right(buf, len(buf) - 5))
elif left(lbuf, 6) = "colour":
color val(right(buf, len(buf) - 6))

elif left(lbuf, 5) = "print":
print right(buf, len(buf) - 5)
elif left(lbuf, 6) = "prints":
print right(buf, len(buf) - 6);

elif left(lbuf, 5) = "pause":
pause val(right(buf, len(buf) - 5))

elif left(lbuf, 5) = "sleep":
pause val(right(buf, len(buf) - 5))

fi
buf = ""
else
buf += t
lbuf = lcase(buf)
fi
next

Before one goes off and designs ones own language one should have at least a medium grasp of the language they intend to write their own language in, and better, some exposure to other languages.

figosdev premise that one could learn programming this way strikes me as backward. Has figosdev so advanced in his own development forgotten how people actually get started?

It seems very basic logic to me to write a new language you have to start with an old one. Sure, then! go ahead and try your new language and learn a bunch more about programming!

I'm sorry, but I am still confused. All this talk of creating a 'new' language, and the way it's portrayed, is not 'new' at all but an existing language being used to create a facade or the 'appearance' of a language. Like using SB or SDLBasic to to 'simulate' the Logo language. It looks like a language but it is merely a fancy interpretation. I hope I am making sense. I mean no disrespect to the programmers' ability to create the work... quite envious actually... but is it 'really' a 'new' language? I have no experience, when it comes to creating a language, I am just telling it like I see it. Please correct me if I am wrong. This is yet another reason why I leave creating languages to those that know...

J

we could go in circles like this forever johnno. if you tell me what *you* think is required for it to be a "new language," i can tell you which parts of that are not requirements, and why.

if i had to answer your question without you being more specific, i could dump a truckload of guesses onto you. it would be dull and a lot of work, and you wouldnt read it. which brings me back to: "if you tell me what *you* think is required for it to be a 'new language,' i can tell you which parts of that are not requirements, and why." i can tell you this though-- theres nothing that makes mgas implementation of logo NOT an implementation of logo. its not 100% new because... well, logo existed. but he implemented it in smallbasic, not in logo. same goes for nano.

I think it's a fine idea for a learning exercise. It may not result in anything useful, but who cares?

It you make an attempt at something and then realise all the gaps in your knowledge, that provides the impetus for further investigation and study.

For something truly useless, yet interesting and funny see:

https://en.wikipedia.org/wiki/Brainfuck

"Has figosdev so advanced in his own development forgotten how people actually get started?"

no. figosdev:

* learned at a very young age, typing examples in from a spiral-bound book published by ibm.

* notes that some people learn javascript as a first language now, there are "javascript for kids" books, and this is easier.

* isnt talking about whatever youre talking about, which is probably more difficult :P

Maybe it's like borders between countries, you see them on maps but in real world... where's the line?

I am curious as to why create 'new' languages within a language? Surely, the 'new' language, will inherit the limitations of the host? As Aristotle once said, "The whole is greater than the sum of its parts". Perhaps it's for the satisfaction that it 'can' be done; Notoriety; Challenge or just pure creativity. (or a combination of any and all )

Although the 'borders' are very clear, on a map, like the reasons for making a language, can be blurred, just like 'real' borders...

Have you watched the documentary "The Birth of Basic"? It's a little 'dry' but quite interesting. https://www.youtube.com/watch?v=WYPNjSoDrqw

J

is not problem if you whish to create your own language
but problem is when you try to do that without enough knowlege or experience
about that..so i agree with Mark about that ..

I totally agree... I am fascinated by the concept of creating a language but I am seriously lacking in both knowledge and experience... *sigh* This is where I get to watch you guys shine...

J

the sad thing is, that most people know the difference between a definition and an instance-- but when it comes to creating languages, people cant get past the fanciest instances. you dont need a 4-stage parser and a machine-code compiler to create a language.

there isnt "a" point in creating a language within an existing language-- there are several points.

but to answer johnno directly-- no, your language will NOT necessarily have all the limits of the language used to implement it. many of those can be worked around, except speed. sometimes thats a real limit, sometimes not.

the point of writing a simple, easy language is to find out how easily you can create a language. then you can build on it (if you want) and learn as you go. a lot of people seem to want to be able to do things, but they think they cant learn. then when presented with an easy way to learn, they say "well what is the point of this?" um, i guess you have to do it for the point to become obvious. making it easy is vital to getting people to try it, so thats the point of doing such a simple version. why not start easy?

its funny-- everyone accepts "hello world" but make a "hello world" of something more complex, like creating a language, and people say "yes, but WHAT IS THE POINT?" well, explain "hello world" to someone who has never coded. except this hello world can turn into something useful VERY quickly. but not until you start.

also:

i didnt invent implementing languages in existing languages. ALL software languages are implemented in existing languages. freebasic does NOT compile to machine code, it compiles to c. qb64-- does NOT compile to machine code, it compiles to c++. fig does not compile to machine code-- it compiles to python. and python is case-sensitive, but fig (like basic) is not. python is sensitive to whitespace, but fig (like basic) is not. you can overcome or override the parameters of your implementation language.

Following figosdev example / idea, Nano uses no other punctuation than a space (A really cool idea I picked up from figosdev!). That is something SmallBASIC can't do and yet it can be done with a small subset of SmallBASIC commands.

This actually might be useful for those like me loosing their eyesight and can't make out the difference between a comma and a period!

i stole the idea from logo. and in particular qb draw strings.

for many years i wondered what it would be like if you could code in basic without punctuation. i could use newlines for strings to avoid quotes, but im ok with quotes.

by the way, im now working on a book inspired by this thread. you can find the first 12 pages here: (it already answers some of johnnos excellent questions) http://www.thejoyfulprogrammer.com/qb64/forum/showthread.php?tid=851

why python and smallbasic are especially nice for language design: http://www.thejoyfulprogrammer.com/qb64/forum/attachment.php?aid=1557

above attachment is page a 260k png image, from this page with about 30 such images: www.thejoyfulprogrammer.com/qb64/forum/showthread.php?tid=851&pid=3596#p... ...a pdf is possible, but while im still working on it i prefer this sort of preview. as long as it doesnt cost walt too much, and from what i understand his plan it should be ok.