M30W Programming Forum

M30W is a text-based version of Scratch

You are not logged in.

Announcement

This is the development forum for M30W (also known as Emerald, do not confuse with Emerald Programming Language).
Our Non-development forums are available here

M30W(Emerald) 0.3 is out! (Download) Requires Python 2.6 or higher.
Opal 0.3(A better command line M30W) is out! (Download) Requires Python 2.6 or higher.
M30W 0.3.6 GUI barebones (Download) Requires Python 2.6 or higher and wxPython
Diamond-2 RED2 GUI Barebones (Fancy M30W editor) s out! (Download) Requires .NET Framework 3.5 or higher, does not require Python
M30W++ GUI barebones (Java M30W) Alpha 1 is out! (Download) Requires Java.


Gershmer.net, our hosting, will close in February 2011. We have not fully decided what to do with our hosting after that, but we will tell you when we decide.

Adverts

Adverts

  • Index
  •  » Development
  •  » When the time comes...the syntax (not done yet, obviously)

#1 2010-05-14 00:50:21

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

When the time comes...the syntax (not done yet, obviously)

Basic string based commands (ex. say)

Code:

say "hi";

The above code prints a string.

The ask command (special)

Code:

ask "name";

It's the ask function, but it by default saves to the reserved variable name "answer".
To save the temporary answer, use this:

Code:

ask "name";
@answer=name_of_your_variable;

Var or String?

Code:

var_name

above is a variable

Code:

"not_a_var"

above is a string

Basic variable or assigned-name based commands (ex. set_costume)

Code:

set_costume picture-of-a-zebra;

Uses the set_costume (commands will NOT contain spaces, nor will variables) command to set a costume to an assigned-name (not a string, while the costume DOES have a name)

Comments

Code:

((comment))

((comment with spaces))

((multi
line
comment))

Multi part functions (str. + var. , etc.) + Example of variable declaration

Code:

"Hello",answer = joined_string_is_now_this_variable

Notice how the comma is outside of the quotes, so it is interpreted as a joiner, rather than part of the string

Broadcasts, Receives

Code:

broadcast broadcast_no_spaces;

/broadcast_no_spaces;
say "hi";
\

A forward slash declares the <when I recieve []> when followed by the broadcast name ( <when I recieve[broadcast]> ),
A back slash closes it.

Reserved Variable, Broadcast Names

Broadcasts:

Code:

start

Variables:

Code:

x-pos
y-pos
direction
costume-num
answer
stage

MORE COMING SOON

(also any sprite names)

Rules

-All lines must end with a semicolon (the easiest way to detect a line break, even if one isn't required


http://card.ly/images/vcard-green-small.png

Offline

 

2010-05-14 00:50:21

AdBot
Advertisements

#2 2010-05-14 00:53:13

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: When the time comes...the syntax (not done yet, obviously)

I forgot: Green flag

Code:

\start
say "test";
/

You'll notice greenflag=broadcast

Printing Variables

Code:

say x-pos;

http://card.ly/images/vcard-green-small.png

Offline

 

#3 2010-05-14 01:23:10

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: When the time comes...the syntax (not done yet, obviously)

AAAAAAAAAAAAAAAAAAH NO!

NO NO NO!

NO!

NOOOOOOO!

NO SEMICOLONS!


http://www.catb.org/esr/faqs/glider.png

Offline

 

#4 2010-05-14 12:02:39

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

cds56 wrote:

AAAAAAAAAAAAAAAAAAH NO!

NO NO NO!

NO!

NOOOOOOO!

NO SEMICOLONS!

Why not? It'll be easy for the compiler to know where the code stops. :/
Plus, Can i post some of the things iv made up?

(creating a sprite)
   
^Start script (Name, not needed, but optional)^ //Just an idea I came up with on the spot
             Load sprite “(location, maybe in an enclosed folder)”, “(the sprites name)”, “(Any further
             attributes like personal variables)”
         //Any further commands can go here, and if they like it, they can do this:
             Unload sprite “(Sprites name)”
^End script^

(Creating a variable)
New var = (Name), (class e.g. integer), (Whether it is global, local or external, option, default is local)


I am A M30Wr.
I always get the last word.

Offline

 

#5 2010-05-14 19:09:21

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: When the time comes...the syntax (not done yet, obviously)

@cds56, semicolons make it easier to tell the end of a line (for ALL commands), and as long as we don't have {'s and }'s, I think we're good.

@marky, to be more like other languages, omit the word new or set or create when dealing with variables.

just

Code:

my_var = "words on paper"

http://card.ly/images/vcard-green-small.png

Offline

 

#6 2010-05-14 19:48:48

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

Gershmer wrote:

@cds56, semicolons make it easier to tell the end of a line (for ALL commands), and as long as we don't have {'s and }'s, I think we're good.

@marky, to be more like other languages, omit the word new or set or create when dealing with variables.

just

Code:

my_var = "words on paper"

Yeah, that better... what about my other one?


I am A M30Wr.
I always get the last word.

Offline

 

#7 2010-05-14 20:38:18

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: When the time comes...the syntax (not done yet, obviously)

New var = (Name), (class e.g. integer), (Whether it is global, local or external, option, default is local)
Hmmm...

Code:

string var = "C#?";

Basically, this is, just like Scratch, an event-driven, imperative, object-oriented procedural language. So naturally, an event could be a broadcast, flag click, or input event (mouse or keyboard). Thus, a script could be starting with

Code:

on (event){

Where "event" will be an object of Event class (implemented in MEOW.Core, this stuff will be really just for MYOC programmers or modders). Note that nothing says "event" is an object of Event class - if Python and JavaScript use smart typing, why can't m30w?
An event could be, for instance, pressing Start (or green flag). Thus, the script will look like:

Code:

on(Start){
}

Start is also an object of Event class. In fact, a MYOC programmer could use the API to create own events and use them in code.

Another thing, the program variables. Let's just use them as user variables, eg. variable for answer would be simply

Code:

answer

And so on. I'm also thinking about simple encapsulation, accessors and how to get rid of global program variables - instead of just 'answer', we could use 'system.answer', or make ask() return a string, so 'var answer = ask("question")'. But then again, we're going too JavaScript with this one. In conclusion, a script inside a sprite may look like this:

Code:

on(receive("spawn")){
    var sprite1.copies is private for sprite;  ((private var declaration, but global for sprite, not just this script))
    set sprite1.copies, 0;
    list sprite1.instances is private for sprite;
    clear sprite1.instances;
    delete all instances (sprite1);  ((note the use of sprite1 as a variable. it's an object, self-reflected. alternatively use of keyword 'this' can be considered.))
    repeat(until sprite1.copies = catInstances){
        var instance is local;  ((variable is local for loop))
        add to sprite1.instances, new instance (sprite1);
        set sprite1.copies, sprite1.copies+1;
    }
}

http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#8 2010-05-14 22:24:31

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: When the time comes...the syntax (not done yet, obviously)

filo5 wrote:

New var = (Name), (class e.g. integer), (Whether it is global, local or external, option, default is local)
Hmmm...

Code:

string var = "C#?";

Basically, this is, just like Scratch, an event-driven, imperative, object-oriented procedural language. So naturally, an event could be a broadcast, flag click, or input event (mouse or keyboard). Thus, a script could be starting with

Code:

on (event){

Where "event" will be an object of Event class (implemented in MEOW.Core, this stuff will be really just for MYOC programmers or modders). Note that nothing says "event" is an object of Event class - if Python and JavaScript use smart typing, why can't m30w?
An event could be, for instance, pressing Start (or green flag). Thus, the script will look like:

Code:

on(Start){
}

Start is also an object of Event class. In fact, a MYOC programmer could use the API to create own events and use them in code.

Another thing, the program variables. Let's just use them as user variables, eg. variable for answer would be simply

Code:

answer

And so on. I'm also thinking about simple encapsulation, accessors and how to get rid of global program variables - instead of just 'answer', we could use 'system.answer', or make ask() return a string, so 'var answer = ask("question")'. But then again, we're going too JavaScript with this one. In conclusion, a script inside a sprite may look like this:

Code:

on(receive("spawn")){
    var sprite1.copies is private for sprite;  ((private var declaration, but global for sprite, not just this script))
    set sprite1.copies, 0;
    list sprite1.instances is private for sprite;
    clear sprite1.instances;
    delete all instances (sprite1);  ((note the use of sprite1 as a variable. it's an object, self-reflected. alternatively use of keyword 'this' can be considered.))
    repeat(until sprite1.copies = catInstances){
        var instance is local;  ((variable is local for loop))
        add to sprite1.instances, new instance (sprite1);
        set sprite1.copies, sprite1.copies+1;
    }
}

nice thoughts there :D!


http://www.catb.org/esr/faqs/glider.png

Offline

 

#9 2010-05-15 17:40:17

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

Can't M30W be OO?


I am A M30Wr.
I always get the last word.

Offline

 

#10 2010-05-15 19:32:40

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: When the time comes...the syntax (not done yet, obviously)

It's going to be OO, but event-driven and procedural.


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#11 2010-05-16 05:45:55

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: When the time comes...the syntax (not done yet, obviously)

cds56 wrote:

AAAAAAAAAAAAAAAAAAH NO!

NO NO NO!

NO!

NOOOOOOO!

NO SEMICOLONS!

That's exactly what I was about to say.

AAAAAAAAAAAAAHHHHHHHH!!!!

NOOOOOOO SSSEEEEEEMMMIIIIICCCOOOOOOLLLLOOOOOOONNNNSSSS!!!!!!!!!!


Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

#12 2010-05-16 13:05:20

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: When the time comes...the syntax (not done yet, obviously)

floppy_gunk wrote:

cds56 wrote:

AAAAAAAAAAAAAAAAAAH NO!

NO NO NO!

NO!

NOOOOOOO!

NO SEMICOLONS!

That's exactly what I was about to say.

AAAAAAAAAAAAAHHHHHHHH!!!!

NOOOOOOO SSSEEEEEEMMMIIIIICCCOOOOOOLLLLOOOOOOONNNNSSSS!!!!!!!!!!

We have to make an end of line character.

How 'bout an ampersand (&)?


http://card.ly/images/vcard-green-small.png

Offline

 

#13 2010-05-16 13:13:09

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: When the time comes...the syntax (not done yet, obviously)

No. ampersand is less accessible (shift+7 = &) than semicolon, and it doesn't seem as an end of line character, more like
if(a = 1 & s = 0) - the AND characters. I'm staying with semicolons ;).


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#14 2010-05-16 16:15:05

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

Go semi-colons and clurly brackets!!!


I am A M30Wr.
I always get the last word.

Offline

 

#15 2010-05-16 16:20:52

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: When the time comes...the syntax (not done yet, obviously)

markyparky56 wrote:

Go semi-colons and clurly brackets!!!

BOO FOR CLURLY BRACKETS IN M30W


http://www.catb.org/esr/faqs/glider.png

Offline

 

#16 2010-05-16 18:23:00

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: When the time comes...the syntax (not done yet, obviously)

Semicolons and curly brackets are for most people the synonym of programming (unless you're an insane VisualBasic nerd). Besides, they're easy for an interpreter to catch on to, which will tell it instantly "oh, I see a {, this is going to be a chunk of code" or "oh, I see a ;, this must be an end of command".


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#17 2010-05-16 19:52:38

bendad
M30W Computer Geek
From: A Place....
Registered: 2010-01-23
Posts: 162
Website

Re: When the time comes...the syntax (not done yet, obviously)

WOOT!!! Go semi-colons and CURRLLY brackets!!!!!!:D:D:D:D:D:D:D:D:):):):lol::lol::cool:


http://bendad.dragonadopters.com/dragonanimated_433188.gif "Fate protects fools, little children and ships named Enterprise" -- Commander Riker

I'm sorry that I am copying Filo5's old signature, but it is very awesome. As they say, imitation is the highest form of flattery.

Offline

 

#18 2010-05-17 11:59:29

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

filo5 wrote:

Semicolons and curly brackets are for most people the synonym of programming (unless you're an insane VisualBasic nerd). Besides, they're easy for an interpreter to catch on to, which will tell it instantly "oh, I see a {, this is going to be a chunk of code" or "oh, I see a ;, this must be an end of command".

Well summed up.


I am A M30Wr.
I always get the last word.

Offline

 

#19 2010-05-19 02:30:09

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: When the time comes...the syntax (not done yet, obviously)

markyparky56 wrote:

filo5 wrote:

Semicolons and curly brackets are for most people the synonym of programming (unless you're an insane VisualBasic nerd). Besides, they're easy for an interpreter to catch on to, which will tell it instantly "oh, I see a {, this is going to be a chunk of code" or "oh, I see a ;, this must be an end of command".

Well summed up.

Yeah, yeah, but I was going for the ease of use  factor.

Code:

print hello

while x is less than 15
print x 
change x by -1
end while

or

Code:

print "hello";
while (x < 15) {
 print x;
change x by -1;
}

I still like my way better, but I'll work with semicolons and brackets....


http://www.catb.org/esr/faqs/glider.png

Offline

 

#20 2010-05-19 06:34:22

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: When the time comes...the syntax (not done yet, obviously)

Code:

Compiler Error (0x054C): Line 4, Col. 1 : "}" expected, found "e" instead.

http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#21 2010-05-19 10:14:31

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: When the time comes...the syntax (not done yet, obviously)

Code:

print "hello";
while (x < 15) {
 print x;
change x by -1;
}

what 'e'?


http://www.catb.org/esr/faqs/glider.png

Offline

 

#22 2010-05-19 18:08:51

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

filo5 wrote:

Code:

Compiler Error (0x054C): Line 4, Col. 1 : "}" expected, found "e" instead.

Filo... that wasn't proper code. :P


I am A M30Wr.
I always get the last word.

Offline

 

#23 2010-05-19 18:39:00

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: When the time comes...the syntax (not done yet, obviously)

This was a compiler output message.


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#24 2010-05-19 19:03:21

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: When the time comes...the syntax (not done yet, obviously)

filo5 wrote:

This was a compiler output message.

it was a very nice output message.

very realistic.


http://www.catb.org/esr/faqs/glider.png

Offline

 

#25 2010-05-19 19:10:30

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: When the time comes...the syntax (not done yet, obviously)

Im very confused.


I am A M30Wr.
I always get the last word.

Offline

 
  • Index
  •  » Development
  •  » When the time comes...the syntax (not done yet, obviously)

Adverts

Board footer

Powered by FluxBB
Hosted by PunBB-Hosting