This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-31 16:35:12

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Blockset

Alright, I've started to build implement a small codebase for Blockset, something that will be kinda sorta similar to scratch that could convert (non-scratch) blocks to textual syntax and vice versa, sort of similar to Etoys. When its finished, one could ignore the block half of the language, or the textual part and still get 100% out of the language. Right now, its being built in Ruby. If you want to help me in any way, go right ahead! Or you could sit around and wait for this to be finished, which it might not ever be.

This is be just for fun, I'm not planning on making it big and popular. But other people could, if they wanted to  tongue

Also, the beginnings of Blockset is currently here.

Thanks!

BASIC PROGRESS:

BLOCK EDITOR IDE
-- 0%

EVALUATOR
-- basically works (missing code for some sort of self, though)

PARSER
-- being implemented

TOKENIZER
-- done, but subject to major change

Last edited by Jwosty (2012-04-16 19:19:24)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#2 2012-03-31 17:57:13

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Blockset

Sounds very interesting!
What language are you thinking of having it output?
(I don't know Ruby, though.  sad  )


http://trinary.tk/images/signature_.php

Offline

 

#3 2012-03-31 18:06:12

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

trinary wrote:

Sounds very interesting!
What language are you thinking of having it output?
(I don't know Ruby, though.  sad  )

I don't really know, I might actually just implement a simple one. Or maybe it could be Ruby, but that would be tough to translate to blocks in some cases...
As for not knowing Ruby, Why's Poignant Guide will fix that. You'd probably like it

Last edited by Jwosty (2012-03-31 18:06:34)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#4 2012-03-31 18:38:45

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Blockset

Ruby certainly looks nice and seems relatively easy to learn.


http://trinary.tk/images/signature_.php

Offline

 

#5 2012-03-31 18:54:46

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

You got that right!


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#6 2012-04-01 06:47:56

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Blockset

From what you're saying, would it not be Scratch-compatible? ie., it wouldn't convert from text syntax to Scratch projects or vice-versa. Because if it *did*, that'd be cool.  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7 2012-04-02 08:01:41

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

No, it probably wouldn't, because it'd have its own blocks with more full syntax.


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#8 2012-04-02 12:15:16

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Blockset

More "full"? How do you mean -- what would you change? (:


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#9 2012-04-02 12:34:56

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Blockset

I've been thinking about building a converter to C#, but not any time soon, too busy, sorry!

I think you may need to have a modified version of Scratch, I've been thinking I could create a mod that outputs a list of sprite names to a text file and exports all costumes and backgrounds since just the project summary won't be enough.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#10 2012-04-02 13:49:44

MrScoop
Scratcher
Registered: 2010-12-17
Posts: 100+

Re: Blockset

Either C# (for app store) or java. I'd definitely use this, although it wouldn't be able to fix the ridiculously lousy graphics.

Offline

 

#11 2012-04-02 18:52:56

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

blob8108 wrote:

More "full"? How do you mean -- what would you change? (:

Its syntax would be as consistent as I can get it to be, like Lisp, so there would only be one type/shape of block. Every block would always return something, even if some sort of nil value. All this is so that it would be pretty simple to translate code in text form to code in block form. I'll make a mockup after I finish writing this post.

sparks wrote:

I've been thinking about building a converter to C#, but not any time soon, too busy, sorry!

Oh, a converter from Scratch projects? Interesting! I've also been thinking about the same thing, but to (yeah, you guessed it) Ruby.

MrScoop wrote:

Either C# (for app store) or java. I'd definitely use this, although it wouldn't be able to fix the ridiculously lousy graphics.

Awesome, thanks for your opinion!  smile

EDIT: Oh yeah, do you guys think it should be interpreted, or compiled just-in-time and possibly AOT, if the latter?

EDIT AGAIN: Uggh, The GIMP is acting up right now (after I installed an XQuartz update)  sad

Last edited by Jwosty (2012-04-02 19:33:23)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#12 2012-04-02 19:12:43

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

Here's an example of a method call and the Fibonacchi sequence. Also, comments will be denoted with double-dashes (--)

Code:

self.foo: 42 bar: 56
  -- Calls the method foo:bar: with the params 42 and "Hello" on self (a keyword [!!!])
  -- Note that this'll raise an error if you don't define the method

  -- The classic Fibonacchi sequence definition.
  -- Also, no keywords to define methods!
self.defName: #fib -- #fib is a symbol. In some other languages, it would be :fib
  params: {#n}     -- An array of parameters. Arrays are defined with special syntax
  body: [           -- The method body. Lambdas are defined with special syntax; can't escape that
      (n < 2).ifTrue: [n]
              ifFalse: [(self.fib: n-1) + (self.fib: n-2)]
    ]
self.printLine: self.fib: 8
  -- Results in 21

Last edited by Jwosty (2012-04-25 18:16:43)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#13 2012-04-04 08:48:20

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

There's a little bit of a codebase beginning to emerge; I'll create a GitHub repo soon.

EDIT: Oh also, I decided to call it "Blockset"; your "typeset" is blocks (well, half the time). Please post your opinion on this! If you can think of a better name, which you guys probably can, I might change it!  smile

Last edited by Jwosty (2012-04-04 08:50:11)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#14 2012-04-04 09:02:45

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

Its up now! See the main post for a link to peek at my code so far.

Last edited by Jwosty (2012-04-04 09:02:54)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#15 2012-04-16 19:25:28

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

Syntax update :D

Also, the lexer is done


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#16 2012-04-18 02:55:37

slinger
Scratcher
Registered: 2011-06-21
Posts: 1000+

Re: Blockset

Sounds totally awesome. I'd use it  smile


http://s0.bcbits.com/img/buttons/bandcamp_130x27_blue.png

Offline

 

#17 2012-04-18 06:29:26

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Blockset

Does the tokenizer compile the program with a runtime engine or something?


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#18 2012-04-18 09:03:59

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

slinger wrote:

Sounds totally awesome. I'd use it  smile

Awesome! The text half is beginning to take shape. And I'll write the IDE in Blockset itself. That should be interesting... xD

nathanprocks wrote:

Does the tokenizer compile the program with a runtime engine or something?

Short answer: no.
What it actually does:
A tokenizer (also called a lexical analyzer, or lexer for short) splits a stream of input characters into usually larger chunks of characters based on how you classify them. For example, take this small Blockset program:

Code:

self.printLine: "Hello world!";

The tokenizer would split it into the following tokens (type first, value second):

Code:

keyw self
special .
m_chunk printLine
special :
str "Hello world!"
special ;

These tokens can be more easily parsed by a parser; one doesn't write a parser completely at the character level (that would be far to complex).

For anyone who wants to know how I built the lexer, I use a library and this is a bit of my (Ruby) code:

Code:

Lexer = Lexr.that {
    #        |||
    # Regexp vvv
    ignores /s+/          => :whitespace
    ignores /--.*/        => :comment    # Blockset comments begin with double dashes, can contain any character, and run until the end of the line.
    matches /"[^"]"/      => :string
    matches "self"        => :key
}

The rest of it is available on the link I provided to Github  wink

Last edited by Jwosty (2012-04-18 09:06:54)


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#19 2012-04-18 09:24:15

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Blockset

Jwosty wrote:

slinger wrote:

Sounds totally awesome. I'd use it  smile

Awesome! The text half is beginning to take shape. And I'll write the IDE in Blockset itself. That should be interesting... xD

nathanprocks wrote:

Does the tokenizer compile the program with a runtime engine or something?

Short answer: no.
What it actually does:
A tokenizer (also called a lexical analyzer, or lexer for short) splits a stream of input characters into usually larger chunks of characters based on how you classify them. For example, take this small Blockset program:

Code:

self.printLine: "Hello world!";

The tokenizer would split it into the following tokens (type first, value second):

Code:

keyw self
special .
m_chunk printLine
special :
str "Hello world!"
special ;

These tokens can be more easily parsed by a parser; one doesn't write a parser completely at the character level (that would be far to complex).

For anyone who wants to know how I built the lexer, I use a library and this is a bit of my (Ruby) code:

Code:

Lexer = Lexr.that {
    #        |||
    # Regexp vvv
    ignores /s+/          => :whitespace
    ignores /--.*/        => :comment    # Blockset comments begin with double dashes, can contain any character, and run until the end of the line.
    matches /"[^"]"/      => :string
    matches "self"        => :key
}

The rest of it is available on the link I provided to Github  wink

Oh because I used a programming language before that compiles the programs into a .tkn file so you can give it to people with the runtime engine.


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#20 2012-04-18 18:41:19

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Blockset

Ah, okay. Yeah, the lexer doesn't actually do anything as far as interpreting the tokens.


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

Board footer