6 ms·
Show HN: Goboscript, text-based programming language, compiles to Scratch
goboscript is a text-based programming language which compiles to Scratch. It allows you to write Scratch projects in text, and compile it into a .sb3 file - which can be opened in the Scratch editor, TurboWarp or be uploaded to the Scratch website.
goboscript allows you to create advanced Scratch projects with ease, you can use any text editor, use a version control system such as git. You can refactor your code using search and replace. Text code can be copy pasted, which allows you to easily reuse code or share it with others. goboscript syntax is concise and easy to read.
goboscript allows you to integrate external tooling and workflows, such as using a script to generate costumes for a text rendering engine. Or loading in images into lists.
goboscript has a powerful macro system - similar to Rust's macro system. This allows you to write macros to generate code.
goboscript is more than just an 1:1 mapping of Scratch blocks to text, it also has additional features like local variables for procedures (custom blocks).
goboscript also performs optimizations, detects problems and unused code.
- arjvik 1y agoThis is beautiful, and brings back so much nostalgia!
- deleted 1y ago[deleted]
- arnavsurve 1y agoThis is hilarious yet awe inspiring at the same time. Great work
- web3aj 1y agoThis is hilarious because it defeats the purpose of scratch.
- sriram_malhar 1y agoOn the contrary. I think it is an excellent bridge between visual and text-oriented programming. It also introduces concepts we take for granted elsewhere: return values from functions, text-based macro substitution, local variables, structs and enums.
- bvrmn 1y agoTell me more about scratch's purpose, please. I believe it's to teach programming. GoboScript seems a natural extension of already conventional environment to more "real" textual programming tasks.
- japanuspus 1y agoThank you for making this! My initial take was to share this with my son who used to built all kinds of things in Scratch, but I know that the lack of simple install instructions will be a deal-breaker for him. Given that (part of) your audience will be persons like my son graduating out of graphical programming in Scratch, it might be worth spending a little time on non-dev install instructions. Even more so as you can leverage the rust toolchain and just suggest something along `cargo install --git ...` [0], without even publishing as a crate. Apologies if this comes across as entitled: I just want to communicate that a single README-sentence on top of the work you already put into this would make it significantly more accessible. [0]: https://doc.rust-lang.org/cargo/commands/cargo-install.html https://doc.rust-lang.org/cargo/commands/cargo-install.html
- aspizu 1y agoThere are handful methods of installation documented in the documentation [1]. The easiest one being installing from git and cargo. For people who do not have the rust toolchain installed, the easiest method is to install pre-built binaries released on GitHub [2]. [1]: https://aspizu.github.io/goboscript/ https://aspizu.github.io/goboscript/ [2]: https://aspizu.github.io/goboscript/install/#install-from-binaries https://aspizu.github.io/goboscript/install/#install-from-bi...
- AlexanderDhoore 1y agoI love teaching Scratch to kids. Some years ago, I used to do "CoderDojo", which is like a hobby club where kids can learn programming. Some kids go to soccer, others to art academy — and these kids learn programming. Super cool to teach. However, most kids get stuck after they master Scratch. Especially kids around the age of 8–10. They learn Scratch. It's awesome. They make some advanced games and really get the hang of it. Then they ask to do something more — some “real programming.” And that's where the hurdles start to pop up. First problem: my kids don't speak English, so most documentation and tutorials are out of reach. Second problem: suddenly they need to learn everything about computers — source files, graphics, networking... This is too big a hurdle for them to take. Third problem: text-based programming. Most of them literally can't type on a keyboard properly. Text is also much less fun than visual programming. What I've always wondered — and this project reminds me of it — is: can we make the transition smoother? Stay within the Scratch ecosystem, which they know, but start introducing extra concepts step by step, without the big jump. GoboScript introduces "text-based programming" as a first step, while staying within the Scratch world. I would have liked it more if we could teach the kids a real-world programming language, like Python or JavaScript — because then they’re moving toward "real programming" step by step. The next step would be: introduce other computer concepts like file systems or networking. I would love to build this myself. Alas, no time. Maybe one day.
- shakna 1y agoWould something like Blockly [0] or MakeCode [1] fill that gap? [0] https://developers.google.com/blockly/ https://developers.google.com/blockly/ [1] https://makecode.microbit.org/ https://makecode.microbit.org/
- WillAdams 1y agoAn interesting usage of Blockly is BlockSCAD: https://www.blockscad3d.com/editor/ https://www.blockscad3d.com/editor/ which uses it to wrap up (most of) OpenSCAD for interactive 3D modeling.
- femto 1y agoIt sounds like you want the ability to instantiate a scratch block that contains a text box, which in turn contains the function body for the block? It would then be possible to incrementally write as little or as much as desired in text. Getting fancy, that block could use a backend interpreter/compiler of choice, so the language could be Squeak, Python, C, an LLM generator, ...
- sriram_malhar 1y agoI love it! It has features that I'd have liked Scratch to have, like return values from functions, local vars, structs etc.
- ferriswil 1y agoLooks fantastic! Now it simply needs a non-Scratch runtime and a Scratch-like frontend, and we'll finally be able to teach bootstrapping to the 5-10 year old demographic.
- aspizu 1y agoadazem009 has been developing an alternative runtime for Scratch written in C++ [1]. It even uses compilation to speed-up the performance of Scratch projects, perfect runtime for goboscript projects. [1]: https://github.com/scratchcpp/libscratchcpp https://github.com/scratchcpp/libscratchcpp
- nis251413 1y agoNext step: create a visual programming language that compiles to goboscript.
- aspizu 1y agoYou can kinda do this using sb2gs [1], which is a decompiler for goboscript. It turns Scratch projects into text-based goboscript projects automatically, for people who wish to work on their Scratch projects in goboscript without having to manually port their entire project to goboscript. Though, sb2gs isn't the best at decompiling everything properly, so a few manual edits are required. [1]: https://github.com/aspizu/sb2gs https://github.com/aspizu/sb2gs
- deleted 1y ago[deleted]
- falcor84 1y agoThis is great! I'd also like to mention pytch.org which takes a slightly different approach to the same problem, essentially recreating most of Scratch within python, and teaching learners how they'd go about writing code to do the same sort of stuff they would have done with Scratch, and then to extend it with python stuff that isn't possible in Scratch. Thinking of it now, I wonder if the two approaches could be combined?
- ninetyninenine 1y agoWhy is text preferable to scratch? What is fundamentally wrong with scratch to make this transition desirable?
- JamesSwift 1y ago(Not OP) Scratch is great. Its an excellent first step. But you hit the limits fairly quickly for what is easy to do "reasonably". So you stay within the limits of what it does well and that limits the kinds of things you can do. And then you risk losing the kids interest to keep at it, if they become bored with the medium. I think Roblox is not a bad next step (tons of out of the box marketplace options), or Ive also been doing a bit of Godot with my kids but with me driving a lot of it while we explore it together.
- ninetyninenine 1y agoWhy not extend the language itself to have the features we want? Why turn it into text?
- Retr0id 1y agoMaking non-trivial things work in Scratch can be fun for similar reasons that it's fun to develop games for the NES in 2025, using modern tooling [0]. NES development would be easier if you upgraded the hardware to be more capable, but that would defeat the purpose. It could still be an interesting project in its own right, but it's not "solving" the same problem. With Scratch, there are also fundamental practical limitations. Dragging stuff around with a mouse becomes a chore, once your code passes a modest size. Maybe you could invent a system of keyboard shortcuts, but that sounds even harder to use. We already have mountains of excellent tools for working with text, from IDEs to git forges. It'd be really hard to build something competitive, for scratch blocks, from scratch. [0] https://github.com/llvm-mos/llvm-mos-sdk https://github.com/llvm-mos/llvm-mos-sdk
- ninetyninenine 1y ago
- _13v6 1y agoIn Not in These two are enough to build a programming language
- varun_ch 1y agoI got into coding through Scratch, and I've been involved with Scratch for over a decade now (I'm 18). I think an often overlooked aspect of Scratch is that it's more than just a drag and drop coding editor; there's an entire community site to share projects on too. And the site is super 'hackable', the APIs are fairly open and all of the client side code is open source too. There's a whole ecosystem of other kids building stuff for/around Scratch (like the Scratch Addons browser extension [0]), as well as projects like this. To be honest, I learnt more from hacking Scratch than using it as intended. I thought this was just a 'me thing', but last summer I was an intern on the Scratch Foundation's engineering team, and my mentor explained that they're totally aware of this effect, and that they take it into account when designing the platform. I like Scratch. [0] https://scratchaddons.com/ https://scratchaddons.com/
- rapestinians 1y ago[dead]
- TrnsltLife 1y agoThis is cool. Also check out Pico-8. I just learned about it and started showing it to my kids, ages 8 - 13. They all liked it and engaged with it to varying degrees. It has a code editor with 8 tabs for organization and uses Lua with some extra functions for the game loop and sprites. It has a built in sprite and map editor, plus sfx and music editor. It reminds me of the integration and experimentation I had with TI Logo and Amiga Basic. There is a free education edition available online.
- jony1266 1y agowhere was this when i was making scratch games in elementary school?? would've been exponentially more efficient to write text instead of dragging blocks around.
- bit-turtle 1y ago[dead]