Discuss Scratch

shadowmouse
Scratcher
100+ posts

bloP - Building Your Own Block Language

Well I don't have chrome, so if i've read it right, I can't. What I mean is, I've been learning c++ by a book that comes with files that let you use commands and syntax that aren't in the standard library. I'm talking about when you use something like: #include “playpen.h”. Whether blockC will be able to locate and use the ‘.h’ file. Hope that makes sense.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

shadowmouse wrote:

I don't have chrome

If you are interested in giving it a try, and you have FireFox, I found out that Firefox doesn't crash when opening blockC (after having loaded bloP) if you keep pressing the “continue” button when it says that the script is taking to long. Remember: do not check the “do not keep asking” checkbox or Firefox will crash (at least on my PC and I have not the faintest idea on why it happens). It takes a bit less than 2 minutes on my very old PC and I had to press “continue” 9 times, but… it worked

shadowmouse wrote:

Whether blockC will be able to locate and use the ‘.h’ file.

What blockC can do is outputting the

#include “playpen.h”

line in the output C code. Then your c++ engine should be able to compile it if you correctly installed it on your PC.
shadowmouse
Scratcher
100+ posts

bloP - Building Your Own Block Language

Ah, okay. Can it do c++ of just c? I will try later, I've got to go and do unimportant things like school now.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

shadowmouse wrote:

Can it do c++ of just c?

It has the basic commands common to C/C++. As for C++, it has:
  • passing parameters by name
  • cin, cout
childishbeat
Scratcher
56 posts

bloP - Building Your Own Block Language

I think bloP is a Scratch mod.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

childishbeat wrote:

I think bloP is a Scratch mod.
Well, not exactly. It is a Snap mod. It is javascript (not Flash). It is an environment in which you can build programming languages very similar to Scratch mods
snaps1
Scratcher
66 posts

bloP - Building Your Own Block Language

s_federici wrote:

Update: online demo of bloP/blockC available at https://sites.google.com/site/blocklanguages/blockc.


Hi Everyone,
I have completed a first draft of “bloP”, a development environment for block languages. The environment is a mod of Snap (well, to be clear, without Snap the whole project just wouldn't be there… Thanks Jens and Brian for your wonderful environment!). bloP stands for “BLOck Programming”.

At the moment I have a ready version of my “block-C” language (a subset of C/C++ implemented as a block programming language) that fully works in bloP. After loading the blockC.xml file in bloP you will see 6 categories of blocks: Input, Output, Control, Functions, Operators, Variables. In the “C programs” and “C++ programs” sprites you will find working examples of blockC programs. In order to run a program just click on its script. By clicking the green flag, the topmost program of the selected sprite will be run. When you click on a new program, the program that is running (if any) will be automatically stopped.

You can try the line demo at https://sites.google.com/site/blocklanguages/blockc.



You can download bloP and blockC at http://goo.gl/quglHp. Please, let me know of every improvement you think I could make to the environment in order to make it really useful and easy-to-use for people who want to develop (or use) block languages.

WARNING: while bloP runs fine either in Chrome, Firefox or IE, blockC on the countrary is a bit heavy, so it runs fine only in Chrome. I didn't investigate it in depth, but on my PC loading blockC crashes Firefox and freezes IE.
I'm developping a simpler version of blockC (only INT variables and only C instructions). Let me know if you are intersted by dropping a line at http://www.blocklanguages.org.

=== How to Startup a block language
To startup the blockC language follow these steps:
1. open bloP.html
2. in File > Open select the blockC.xml file (if during loading your browser tells you that there is a script that is not responding… just wait a little bit)
3. you can run the sample programs that you find in “C programs” or “C++ programs” or you can create your own blockC programs by adding (“+” button) or duplicating a program (rightclick menu) or by using File > New in order to create a completely new blockC program. Just snap together the C/C++ blocks you will find in the Input, Output, Control, Functions, Operators, and Variables categories.
4. save your programs by using File > Save As… The programs will be saved in a new XML file (NOTE: in this version the XML file will include both the programs and the whole definition of the block language)


=== How to Modify or Create a block language
To create a new block language, just follow these steps (if you want to modify the blockC language, follow steps 1 and 2 above in order to load blockC in advance):
1. shiftclick the bloP logo and select “Unlock GUI” in the menu
2. show the primitives you need by rightclicking in the palette and selecting “show primitives” in the menu
3. make all icons visible in the corral by rightclicking the corral and selecting “add removed objects back to corral”
4. modify the environment as you like by:
- modifying custom blocks or adding new custom blocks
- renaming categories by righclicking them
- restoring default names and visibility for all categories by rightclicking the category frame
5. When you are done, go back to the bloP environment by shiftclicking the bloP logo and selecting “Lock GUI”


=== bloP Philosophy
In order to make the bloP environment safe (that is, you won't be allowed to modify the bloP environment when it is “locked”: you won't be able to define new blocks, drag sprites, etc), so that when you write and run your programs you won't risk to impair the environment, I made some modifications to Snap, trying not to change the way Snap works (you should be able to load and run Snap XML files without any modification):

Modifications to Snap:
- you can hide/rename categories (when you hide a category, all primitives of that category will be hidden)
- you can hide the Stage and the sprites icons in the corral (but you need at least one visible sprite icon in the corral)
- you have 3 new Control blocks:
- hat “when loading”: the script under this hat is run when a program is loaded in Snap/bloP
- hat “when running a script”: the script under this hat is run in bloP before another script is run (that is when you click on it or you click the green flag)
- block “run other scripts”: this block, used at the end of a script that starts with the “when running” block, runs the script you intended to run when you clicked on it or clicked the green flag
- you can switch from Snap to bloP (and viceversa) by shiftclicking the logo and selecting “lock/unlock GUI”.

When you lock the Snap GUI and switch to bloP you will have a different environment in which:

Core modifications:
- sprites/watchers on Stage are non draggable
- variable and list watchers cannot be modified
- by clicking the green flag you run the topmost script of the selected sprite
- you can't have programs (sprites) with the same name

UI modifications:
- you don't see sprite infos such as rotation style and draggability
- you can't hide/show primitives
- you can't hide/rename categories
- “sprites” are renamed “programs”
- you can't define or remove custom blocks
- you can't change settings
- you can't use the cloud storage
- costumes and sounds tabs are hidden
- the button to create new sprites by drawing them is hidden

By shiftclicking the Snap logo you will be able to lock the GUI so that your language users won't be able to impair the environment by doing something wrong. But they will still be able to modify the environment, if they want, by shiftclicking the bloP logo and knowingly unlocking the environment.


=== Create your own block language
These features should allow you to develop your own programming language built by blocks.

By shiftclicking the bloP logo you will be able to unlock the GUI so that you will have the full power of Snap available to develop your own language blocks.

Use the “when loading” and “when running” blocks to define scripts that you need to run at setup time in order to prepare your environment (“when loading” hat) or to cleanup your environment each time a new program runs (“when running” hat). Remember: your users will be able run a new program even before the running program has halted (the running program will be stopped).

bloP always runs in “locked” mode at startup so, when you are done, all you need to do is saving your language: there is no need to move back to bloP before saving. Furthermore, when your users will load your language in bloP they won't be able to impair the environment by doing something wrong.


=== Comments are Welcome!!!! (and this is just an understatement… :-)
I'm very interested in hearing from you. Really. I'm serious. VERY interested. The present design of bloP is mainly oriented to the implementation of text languages (such as C, Perl, Python, etc) but I'm adding new features, so, if you have any suggestion about what you would need in order to implement your own block language (textual or visual), or you think that you had a good idea on how to improve bloP or you just found a bug, drop me a line at http://www.blocklanguages.org.


=== Future Work
I'm working on importing in bloP other block languages I had started to develop in BYOB, namely ASSL (a visual language to design searching/sorting algorithms) and a subset of Berkely Logo. If you want to collaborate to create an extensive library of block languages, please, do not hesitate to contact me at http://www.blocklanguages.org.


=== Known Problems:
- you can't use single quotes in block names (see “A” block in Operators category. It should be ‘A’ instead…)
- the comma after the last arguments of a function shouldn't be there… (you can notice that I started working on this in the dialog of the properties of input arguments for custom blocks)
- rings can be really confusing to people that don't know what they are (this can happen to users of your own language that don't have to know Snap in advance). So I'm going to remove them when bloP is in locked mode.
- switching between Snap and bloP is a bit slow (the whole program is saved and then reloaded). I'm planning to speed up this operation together with the operations of loading/saving bloP projects.
- having menu inputs for custom blocks would help a lot to create block languages that are much simpler and clear (you can notice that I started working on this in the dialog of the properties of input arguments for custom blocks)
- watchers on the Stage don't grow or shrink in small Stage or presentation mode
- lists do not scroll to show the last added element

FINAL NOTE: bloP is based on Snap version 24/7/2013.
IT WONT WORK! PLZ!
MrSherlockHolmes
Scratcher
500+ posts

bloP - Building Your Own Block Language

Awesome!
CatsUnited
Scratcher
1000+ posts

bloP - Building Your Own Block Language

It doesn't load for me; it thinks the script is suspicious and has disactivated it.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

snaps1 wrote:

IT WONT WORK! PLZ!

Sorry. It seems that Chrome and Firefox updated their policy for allowing external content in web sites. In the meantime, you can see the content in your browser by clicking on the shield icon you will find in the browser address bar when you access the BloP's demo page.

Let me know how this worked for you.
rdococ
Scratcher
1000+ posts

bloP - Building Your Own Block Language

How did you move the categories in blockC?
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

rdococ wrote:

How did you move the categories in blockC?

To change the elements of the BloP interface you have to shift-click the BloP icon at the top left corner and select “Unlock gui”. Then you can right-click category buttons, blocks in the palette, sprite icons, etc and you can choose to show/hide and rename those elements. When you are done you can relock the gui and use your new GUI.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

MrSherlockHolmes wrote:

Awesome!

Thanks
CatsUnited
Scratcher
1000+ posts

bloP - Building Your Own Block Language

Are you really sure the script is safe?
rdococ
Scratcher
1000+ posts

bloP - Building Your Own Block Language

s_federici wrote:

rdococ wrote:

How did you move the categories in blockC?

To change the elements of the BloP interface you have to shift-click the BloP icon at the top left corner and select “Unlock gui”. Then you can right-click category buttons, blocks in the palette, sprite icons, etc and you can choose to show/hide and rename those elements. When you are done you can relock the gui and use your new GUI.
I meant recolor them. Usually, yellow is in the top right, but in BlockC, it is on the top left.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

rdococ wrote:

I meant recolor them. Usually, yellow is in the top right, but in BlockC, it is on the top left.

I didn't add a way of recoloring the category buttons (yet; I haven't felt it necessary as of now). Categories are simply reaordered while you rename them.
CatsUnited
Scratcher
1000+ posts

bloP - Building Your Own Block Language

When i run bloP , it's just Snap!, butwithout costumes or sounds, just the program.
SimpleScratch
Scratcher
500+ posts

bloP - Building Your Own Block Language

I've been wanting someone to produce a Python block based IDE as a transition tool between Scratch and Python for the past 2 years.

This looks like an excellent method of getting it going off the ground

Have you started on one yet? as don't want to duplicate work

Simon
ev3commander
Scratcher
500+ posts

bloP - Building Your Own Block Language

This looks a bit complicated..?
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

CatsUnited wrote:

When i run bloP , it's just Snap!, butwithout costumes or sounds, just the program.

BloP is Snap, with some added blocks and features. To see the full Snap with the new blocks (“when loading and never stop”, “when running another script”, “run other script” in the Control category) just shift-click the BloP icon at the top left corner and choose “unlock GUI”. With these features you can create a full new block language, without auxiliary blocks and auxiliary sprites around. You can download the full environment and test, e.g., the blockC language (a block version of a subset of the C/C++ language). By Unlocking the GUI you can then show all hidden elements (by using the right-click menu on the block palette and sprite corral). Have a look at it and… let me know how it worked for you.

Powered by DjangoBB