Among the esoteric languages I've learned, Piet is by far, hands down, my favorite. But it's curiously opinionated about reading input. I don't think any interpreter / compiler gets it right, mine included. Painting (one does not write) Piet code to safely handle input, by that spec, is particularly annoying.
Re:Piet, a programming language in which programs look like ...
by boothby on Monday December 30, 2019 @04:32PM
(#21916893)
Cool, I haven't seen your interpreter! I'll have to give it a read through.
npiet is good, and I use its examples for testing, but FYI it diverges from the spec in how it handles whitespace. According to DMM, if the cursor enters a loop entirely within whitespace, the program should terminate. Currently, npiet doesn't have a cycle-detection algorithm so it hangs.
One of these days I'll get around to making my test infrastructure and polishing up my tests... but I've recently had some weird thoughts about a place&route algorithm to replace my existing Piet backend and that's more interesting. First step, design a router that creates right-hand-rule paths through whitespace? What am I even doing with my life...
Re:Piet, a programming language in which programs look like ...
by tess0r on Tuesday December 31, 2019 @06:49AM
(#21920426)
I implemented my interpreter with the goal to learn some rust. So please let me know should you find things to improve :)
I remember a point in development when I implemented whitespace handling and cycles therein. I thought I had implemented the spec but some example programs did not run properly. Maybe that was because of the divergence in the spec vs. npiet you mentioned. Since my main goal was to learn rust I just made the example programs work and did not double check the spec again. Will look into it again when I find some time :)
Re:Piet, a programming language in which programs look like ...
by shakna on Monday December 30, 2019 @09:14PM
(#21918462)
> Well, let's back up a minute for the folks missing context. Recently there have been a spate of blog posts of folks claiming that their pet language is "faster than C" by implementing a feature-incomplete version of the wc utility and running a single benchmark to demonstrate superiority.
I believe they are well aware of the limitations that have been shown in these recent benchmarks, and that it doesn't in fact demonstrate superiority in any way.
Re:Piet, a programming language in which programs look like ...
by zingermc on Monday December 30, 2019 @06:13PM
(#21917554)
A while ago, I tried making a Piet compiler in Haskell that emits LLVM IR. Eventually I found an inconsistency between my interpretation of the spec and npiet's implementation, so some Hello World examples would print something like "Hello wowowowowo...".
Re:Piet, a programming language in which programs look like ...
by jboy55 on Monday December 30, 2019 @01:58PM
(#21915755)
My phone screen coding question, designed to be obvious and quick, was to do pow(base, exp). I would always tell the interviewee that they could use any language they are comfortable in. Thinking ahead, I wanted to be prepared for the eventual, 'well I'll use Whitespace!'. So I sat down during a hack day and did whitespace, Piet, LolCat and tried to do BF. Piet was the most enjoyably hard. Figuring how to store variables was a nice brain test, I really felt I had acomplished things. Whitespace is super easy in comparison and I couldn't figure out how to do a variable length outer loop in BF.
2016: https://news.ycombinator.com/item?id=11342442
2014: https://news.ycombinator.com/item?id=7727702
2012, cheekily titled: https://news.ycombinator.com/item?id=4698737
2011: https://news.ycombinator.com/item?id=2430357
2010: https://news.ycombinator.com/item?id=1166462
2008 (not much): https://news.ycombinator.com/item?id=139872
https://github.com/boothby/repiet/blob/master/README.md#but-...
Among the esoteric languages I've learned, Piet is by far, hands down, my favorite. But it's curiously opinionated about reading input. I don't think any interpreter / compiler gets it right, mine included. Painting (one does not write) Piet code to safely handle input, by that spec, is particularly annoying.
I guess the best reference for implementing new interpreters is npiet and testing all example images.
[1] https://github.com/tessi/rpiet
npiet is good, and I use its examples for testing, but FYI it diverges from the spec in how it handles whitespace. According to DMM, if the cursor enters a loop entirely within whitespace, the program should terminate. Currently, npiet doesn't have a cycle-detection algorithm so it hangs.
One of these days I'll get around to making my test infrastructure and polishing up my tests... but I've recently had some weird thoughts about a place&route algorithm to replace my existing Piet backend and that's more interesting. First step, design a router that creates right-hand-rule paths through whitespace? What am I even doing with my life...
I remember a point in development when I implemented whitespace handling and cycles therein. I thought I had implemented the spec but some example programs did not run properly. Maybe that was because of the divergence in the spec vs. npiet you mentioned. Since my main goal was to learn rust I just made the example programs work and did not double check the spec again. Will look into it again when I find some time :)
I believe they are well aware of the limitations that have been shown in these recent benchmarks, and that it doesn't in fact demonstrate superiority in any way.
https://github.com/dmcardle/piet-llvm-frontend
https://www.dangermouse.net/esoteric/piet/samples.html