News for hackers. Stuff that matters.
Re:Piet, a programming language in which programs look like ... by jagged-chisel on Monday December 30, 2019 @02:54PM (#21916127)
The 2012 link says "No such item." Is this it? https://news.ycombinator.com/item?id=4698737
Re:Piet, a programming language in which programs look like ... by dang on Monday December 30, 2019 @03:51PM (#21916608)
Yup! Thanks. Fixed now.
Re:Piet, a programming language in which programs look like ... by boothby on Monday December 30, 2019 @01:05PM (#21915345)
Bears mentioning that Piet is "faster than C" if you use the right compiler.

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.

Re:Piet, a programming language in which programs look like ... by tess0r on Monday December 30, 2019 @02:08PM (#21915818)
I agree. I've written an interpreter in rust [1] and input handling, esp for numbers, was really annoying.

I guess the best reference for implementing new interpreters is npiet and testing all example images.

[1] https://github.com/tessi/rpiet

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 markemer on Monday December 30, 2019 @07:58PM (#21918138)
One of these days we’ll need to get IEEE to formalize a standard.
Re:Piet, a programming language in which programs look like ... by downerending on Monday December 30, 2019 @06:20PM (#21917597)
C is also "faster than C" if you use the right compiler.
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 boothby on Tuesday December 31, 2019 @12:37AM (#21919193)
Well yes, the example uses a C backend and everything.

  repiet wc.png -o wc.c --backend c --codel_size 10 -O 2
  gcc wc.c -o wc -O3
I hacked it together in response to a "brainfuck is faster than C" HN post and stale jokes don't die on my watch.
Re:Piet, a programming language in which programs look like ... by downerending on Tuesday December 31, 2019 @12:45PM (#21922850)
I, too, was joking. Mostly. :-)
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...".

https://github.com/dmcardle/piet-llvm-frontend

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.
Re:Piet, a programming language in which programs look like ... by maddyboo on Monday December 30, 2019 @01:10PM (#21915373)
The list of example programs is really fascinating:

https://www.dangermouse.net/esoteric/piet/samples.html

Re:Piet, a programming language in which programs look like ... by dmos62 on Monday December 30, 2019 @05:44PM (#21917359)
At the bottom there's a text adventure game and a brainfuck (another esoteric language) interpreter.
Re:Piet, a programming language in which programs look like ... by plopz on Monday December 30, 2019 @12:30PM (#21915053)
For whatever reason, it makes me really happy that esoteric languages like Befunge, vigil or Half-Broken Car in Heavy Traffic exist.
Re:Piet, a programming language in which programs look like ... by bussierem on Monday December 30, 2019 @02:22PM (#21915915)
You should take a look at Rockstar: https://github.com/RockstarLang/rockstar
Re:Piet, a programming language in which programs look like ... by dibujaron on Monday December 30, 2019 @11:51PM (#21919046)
Wow, David Morgan-Marr does neat language projects as well as the awesome webcomics? That guy is a machine.