Discuss Scratch

mlcreater
Scratcher
1000+ posts

TextScratch - A programming language in Scratch.

mybearworld wrote:

Making progress. For some reason I stopped with it - but I am currently having a “compile” function that compiles anything. Still only two commands…
The machine code for
me = Cat
wait 0.4
me = Dog
looks like
001
001
000
002
001
0.4
001
000
001
004
000
Now I just need to write something that actually executes this code.
Also there's errors now!
What do each of those lines mean?

It looks like possibly the ‘machine code’ representation of each TextScratch statement might with a 000 line, because there are three 000 lines for 3 statements and this would mean each me = _ statement is a 001, then a costume #, then a 000…

However, this separation by 000 implies also that the wait _ statement is 002 + 001 + 0.4 + 001 + 000, which uses the “me = _” statement's 001 code…

page 16

Last edited by mlcreater (Jan. 29, 2021 19:50:52)


← there are 3 sig figs and 0 kumquats





mybearworld
Scratcher
1000+ posts

TextScratch - A programming language in Scratch.

mlcreater wrote:

mybearworld wrote:

Making progress. For some reason I stopped with it - but I am currently having a “compile” function that compiles anything. Still only two commands…
The machine code for
me = Cat
wait 0.4
me = Dog
looks like
001
001
000
002
001
0.4
001
000
001
004
000
Now I just need to write something that actually executes this code.
Also there's errors now!
What do each of those lines mean?

It looks like possibly the ‘machine code’ representation of each TextScratch statement might with a 000 line, because there are three 000 lines for 3 statements and this would mean each me = _ statement is a 001, then a costume #, then a 000…

However, this separation by 000 implies also that the wait _ statement is 002 + 001 + 0.4 + 001 + 000, which uses the “me = _” statement's 001 code…

page 16
You're right with that 000 thing.
002 + 001 + 0.4 + 001 + 000
That's correct.
002 #wait 
001 #number
0.4 #0.4
001 #number end
000 #statement end

Signatures are the only place where assets links still work.
Greg8128
Scratcher
500+ posts

TextScratch - A programming language in Scratch.

You don't necessarily need a code for the end of a statement though. Each statement can expect a fixed number of arguments (for example wait n seconds expects 1 numbered argument)

So you could do wait 0.4 seconds as
002
0.4

My best projects:

mybearworld
Scratcher
1000+ posts

TextScratch - A programming language in Scratch.

Greg8128 wrote:

You don't necessarily need a code for the end of a statement though. Each statement can expect a fixed number of arguments (for example wait n seconds expects 1 numbered argument)

So you could do wait 0.4 seconds as
002
0.4
I made this for consistency. When I'll add reporters, I'm gonna have to mark the end of a calculation, for example 2+4-var. It can't expect a fixed value.

Signatures are the only place where assets links still work.
mlcreater
Scratcher
1000+ posts

TextScratch - A programming language in Scratch.

mybearworld wrote:

Greg8128 wrote:

You don't necessarily need a code for the end of a statement though. Each statement can expect a fixed number of arguments (for example wait n seconds expects 1 numbered argument)

So you could do wait 0.4 seconds as
002
0.4
I made this for consistency. When I'll add reporters, I'm gonna have to mark the end of a calculation, for example 2+4-var. It can't expect a fixed value.
Which reporter will be added first?

← there are 3 sig figs and 0 kumquats





Greg8128
Scratcher
500+ posts

TextScratch - A programming language in Scratch.

Something to note: converting infix notation (e.g. "3 * 5 + 4 - 2 * 2) to assembly code is tricky because of order of operations rules. This is not to say that you shouldn't try; just do your research first. Look up an algorithm for doing it efficiently. Look at documentation for C or Java to see what order of operations rules they used. (you don't have to copy it verbatim. Just note where operators such as <=, == and && fit in).

If it doesn't work out, remember that Lisp doesn't have order of operations but still manages to be a great language.

My best projects:

gosoccerboy5
Scratcher
1000+ posts

TextScratch - A programming language in Scratch.

Greg8128 wrote:

If it doesn't work out, remember that Lisp doesn't have order of operations but still manages to be a great language.
When in doubt, add more parentheses! Simple.

Last edited by gosoccerboy5 (Feb. 10, 2021 02:12:40)


skymover1239
Scratcher
500+ posts

TextScratch - A programming language in Scratch.

How close is 0.0.2 to be done?



John 3:16 wrote:

For God so loved the world that he gave his one and only Son that whoever believes in him shall not perish but have eternal life
First time a moderator got ninjaed??
500 Posts
Current Mainline projects
AquaCSS - A CSS framework.
Ink - An editor that does, lots of things.

Powered by DjangoBB