PLOGO

A tiny toy implementation LOGO language

..

For the past week or two I've been hacking on and off on PLOGO, my name for a tiny implementation of the LOGO language that I am implementing in Javascript, built on the p5.js drawing library.

PLOGO on Tildegit

It's highly inefficient! It's not original, not even in Javascript!

I've not really made my own domain-specific language before. And I can't argue that it hasn't been done before. But I'm doing it because it's fun, a mini challenge, and I'm learning a bit. Not only am I enjoying the problem-solving features of working on a language implementation, I'm enjoying using the little language on my own small art coding sketches that I do.

I made a very simple quilt first.

And something that emulated an Anni Albers fiber work

Then a simple almost quiltlike roguelike map

And a retro-themed drunk turtle random walk

These are all implemented in earlier versions of my plogo library. You'll see a progression here perhaps. The last link even has the console of program text printed right on the screen, a nod to the Apple II LOGO I had my students play with in our class last week

Since I'm working with the p5.js library, I did not need to implement a parser. It would have helped me in at least one instance (drawing background color with a command, making sure it draws the background at the right time). I decided just not to implement a background color since p5.js already has this functionality. In essence, I've sort of settled into writing new LOGO-like commands but allowing straightup javascript and p5.js commands as well to all coexist. I'm relying on JS for the looping, though i'd prefer a more LOGO-like simple loop, using a word like repeat. I'd also prefer not to use parenthesis but I don't know how to implement that as-is. I started wondering what it would be like to build my language in Lua, but the goal here is to make this work on the web i think, so I'll leave this approach for now, but I really do wish I could get rid of parenthesis. I also think it could be nice to implement this on a serverside to automate making images, but p5.js can't work this way without a heavier lift like puppeteer. But I think Lua could, or definitely Processing-java on the server could work.

I added a retro() command that slightly blurs the canvas and applies a black-and-white threshold. It's slow, but I like the aesthetic, even if it's slightly hokey.

For now, I've used my little lang to make maybe 6 or 8 images as websites on my everyday code sketching sub-site. I will possibly continue to make some little things like digital quilts. I don't know if I'm finished with development or if I'll continue to add commands for example, but I'm happy with where it's at right now as a proof of concept.

back to index

---

Comments can be emailed to lettuce@ctrl-c.club