Amy J. Ko
2 min readDec 3, 2020

--

I see where you’re going with this, but the notion of blocks you’re describing is already part of all programming language specifications. We just don’t call them blocks, we call them non-terminals in a programming language’s grammar. For example, consider the optional curly braces in a while loop in JavaScript. In the JavaScript language definition, the list of statements that come after the while are actually (coincidentally) defined as a non-terminal named “block” (the word block in this case refers to lexical scoping). It’s the non-terminal that defines the boundaries around the program structure; the curly braces, as you note, are just syntactic sugar, and inessential for defining semantics. (Only when someone is writing JavaScript in text do they become necessary to disambiguate structure).

Scratch has a grammar too; because it is only ever edited using a block-based editor, it can remove delimiters, since there is no parsing of serial text. However, note that it cannot remove them for the purpose of presentation: it’s still essential to delimit structure in Scratch programs by surrounding structure with colored rectangles. Colored rectangles, curly braces, whatever: they all do the same thing, which is denote the boundaries of structure implied by non-terminals in a programming language’s grammar. If you removed the colored rectangles—just as if you removed the curly braces—the program could not be parsed. That’s just a matter of presentation and editing, not a matter of the language itself.

Because non-terminals already define block structure, if we used your logic, then all programming languages would be “block-based”, since all languages have a grammar that defines structure in terms of non-terminals. Using programming language terminology, however, we would just say that all structure in programming languages is defined by a language’s grammar and it’s non-terminals, including Scratch.

--

--

Amy J. Ko
Amy J. Ko

Written by Amy J. Ko

Professor, University of Washington iSchool (she/her). Code, learning, design, justice. Trans, queer, parent, and lover of learning.

Responses (1)