Discuss Scratch

s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

SimpleScratch wrote:

I've been wanting someone to produce a Python block based IDE … Have you started on one yet?

That is something that I definitely wanted to do Even if I didn't start yet, I guess it should be fairly easy to build a block version of the Python language by starting from the blockC language.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

ev3commander wrote:

This looks a bit complicated..?

Well, it could be It certainly is if you are not interested in developing or using a block version of a different language. But, if you are interested in such an effort, then you are going to see BloP as a real simple and convenient tool.
ev3commander
Scratcher
500+ 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.
i cant load blockc
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

ev3commander wrote:

i cant load blockc

Are you using the website? I tried the https://sites.google.com/site/blocklanguages/blockc link and it worked on my Chrome 41 in Windows 7. If this doesn't work for you, did you try downloading the package from https://sites.google.com/site/blocklanguages/downloads/bloP.zip?attredirects=0&d=1?

Please, let me know how this worked for you.
ev3commander
Scratcher
500+ posts

bloP - Building Your Own Block Language

s_federici wrote:

ev3commander wrote:

i cant load blockc

Are you using the website? I tried the https://sites.google.com/site/blocklanguages/blockc link and it worked on my Chrome 41 in Windows 7. If this doesn't work for you, did you try downloading the package from https://sites.google.com/site/blocklanguages/downloads/bloP.zip?attredirects=0&d=1?

Please, let me know how this worked for you.
i downloaded blop and blockc and then ran blockc and after about 40 minutes it was still blank.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

ev3commander wrote:

i downloaded blop and blockc and then ran blockc and after about 40 minutes it was still blank.

I'm sorry, I downloaded the package, opened the blop.html file in Chrome (version 41) by doubleclicking it, then, using the “open” option in the “file” menu, I selected the blockC.xml file. After less than 30 secs I saw the blockC language.

Then I tried again by enabling energy-saving on my PC and this time it took 2.5 minutes to load blockC. This after answering 4 times “wait” to the “suspend/wait” messages from Chrome as the script was taking too long. Did you see those messages? If you do, please try answering “wait”.
ev3commander
Scratcher
500+ posts

bloP - Building Your Own Block Language

No I didn't. In chrome there's no file menu, just a little page icon and I opened blockc.XML and it didn't work. Also I can't unlock GUI.
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

ev3commander wrote:

In chrome there's no file menu, just a little page

Yes, exactly, that is the Snap's/BloP's file menu. When I select “open” in that menu and select the blockC,xml file, on my PC it opens in less than a minute (or in two minutes if I'm activating energy saving in order to simulate a slow PC). And I can also unlock the gui by shiftclicking the BloP icon at the top left corner. I can't understand why this is not working for you. Sorry. I'm really willing to help, but I don't understand where the problem could be. I developed this tool almost a year ago, so your Chrome 32 should be just fine and I'm using Windows 7 too.
ev3commander
Scratcher
500+ posts

bloP - Building Your Own Block Language

s_federici wrote:

ev3commander wrote:

In chrome there's no file menu, just a little page

Yes, exactly, that is the Snap's/BloP's file menu. When I select “open” in that menu and select the blockC,xml file, on my PC it opens in less than a minute (or in two minutes if I'm activating energy saving in order to simulate a slow PC). And I can also unlock the gui by shiftclicking the BloP icon at the top left corner. I can't understand why this is not working for you. Sorry. I'm really willing to help, but I don't understand where the problem could be. I developed this tool almost a year ago, so your Chrome 32 should be just fine and I'm using Windows 7 too.
Oh. I forgot and accidently right-clicked instead of shiftclick. still, blockc is too long
ramgarden
New Scratcher
1 post

bloP - Building Your Own Block Language

This would be great (but probably very very large) for ESRI ArcGIS ArcObjects! We could create a block for a geospatial search and do nice queries and things against the geodatabase with just a block or two! I can see it make some pretty powerful GIS apps with just some simple puzzle piece connections!
Great job creating this! Now where do I start…
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

ramgarden wrote:

This would be great (but probably very very large) for ESRI ArcGIS ArcObjects! We could create a block for a geospatial search and do nice queries and things against the geodatabase with just a block or two! I can see it make some pretty powerful GIS apps with just some simple puzzle piece connections!
Great job creating this! Now where do I start…

Hi ramgarden, if you need help just show me a few examples of what you would like to get (I'm not an expert of ArcGIS ArcObjects, I just know they are used by people interested in environmental problems).
KWB10
Scratcher
2 posts

bloP - Building Your Own Block Language

@bloplol07 much
-penandpaper-
Scratcher
100+ posts

bloP - Building Your Own Block Language

This looks really cool! I'll have to try it out.
mlvda
Scratcher
13 posts

bloP - Building Your Own Block Language

Thanks now I'm making my own Block Language called Particle-2
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

mlvda wrote:

Thanks now I'm making my own Block Language called Particle-2

Did you creare this language by using BloP. BloP has been updated recently. Let me know if you need help
mlvda
Scratcher
13 posts

bloP - Building Your Own Block Language

I am using the old bloP and I don't how to change the code to make it link to my website and also the Blocks don't work and they don't do anything here is the Github https://github.com/SomeGithubPerson/Particle-2 and my account https://github.com/SomeGithubPerson
mlvda
Scratcher
13 posts

bloP - Building Your Own Block Language

Found out why it was buggy I was using firefox
mlvda
Scratcher
13 posts

bloP - Building Your Own Block Language

I was wrong. when picked start when the green flag has been clicked does not work but the when press (any letter or number here) works so for example
Press flag does not work
Press space to move 10 steps √
s_federici
Scratcher
500+ posts

bloP - Building Your Own Block Language

mlvda wrote:

I am using the old bloP and I don't how to change the code to make it link to my website and also the Blocks don't work and they don't do anything here is the Github https://github.com/SomeGithubPerson/Particle-2 and my account https://github.com/SomeGithubPerson
I should be able to have a look at it by today
mlvda
Scratcher
13 posts

bloP - Building Your Own Block Language

s_federici wrote:

mlvda wrote:

I am using the old bloP and I don't how to change the code to make it link to my website and also the Blocks don't work and they don't do anything here is the Github https://github.com/SomeGithubPerson/Particle-2 and my account https://github.com/SomeGithubPerson
I should be able to have a look at it by today
I added a file called oktester.mov so I can show you a test of the of it (the video runs slow since I had to use Quicktime Player)

Powered by DjangoBB