Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Ink programming language (dotink.co)
139 points by galfarragem on July 11, 2021 | hide | past | favorite | 27 comments


Hey HN, OP here. Ink isn't really anywhere near in a shape for any kind of "public" or "production" use. It was a toy programming language I built to (1) learn how interpreters worked and (2) build some side projects of mine, back in 2019. Since then it's grown steadily to allow me to build more complex full-stack apps, like Monocle[0]. But the truth is many parts of the language are still rough and mostly meant for personal use. So I guess what I'm saying is — please be gentle, and hopefully there are some interesting ideas in there, or at the very least, it inspires someone else to go build toy languages of their own.

If you're curious about the personal history of the project, Ink was the subject of a recent talk I gave at GopherCon EU[1]

[0] https://github.com/thesephist/monocle

[1] https://youtu.be/nNQHw_RdXvg

EDIT: If any mod is reading, the language is called "Ink" not "dot ink", though the domain is confusing. If the title could be modified that would be... swell.


Very, very impressive. I just spent the last hour going down the rabbit hole of reading your blog and browsing through your different side projects (which I can only recommend to fellow HN readers, the programming language posted here really is just the tip of the iceberg). Creating your own programming language is remarkable in its own right, but then using it to build your own frontend & backend frameworks, search engine, productivity suite, 3D renderer and a bunch of other apps ist just impressive on another level.

What I find most fascinating about your side projects is how you bring together a number of different skills in a way that looks almost effortless. Knocking out a search engine or a twitter reader as a throwaway learning project is one thing, but doing it over the course of little more than a week with a well designed UI in a way that ends up being useful in your own workflows? That not only takes some serious work but also the ability to correctly judge which directions not to go in, which can be one of the hardest aspects of developing software.


Thanks! This comment made my day. Certainly knowing which directions not to go in is a big part of my efficiency, and something I'll point to whenever I get asked that question in the future.


"dot ink" might be better, given the name clash with Inkle Studios' interactive fiction language: https://www.inklestudios.com/ink/


Yeah, came here expecting to hear about an update from Inkle Studios. (I checked them out anyway since Heaven’s Vault is one of the most kind-blowing games I’ve ever played, and they do have a new game out! Their ink language is worth a look.)


I made the same mistake. I've been aware of Inkle Studios' work for some time now, and I thought it was an article on new developments in that.


there is also the DOT language for schematics from AT&T


This is such a beautifully designed language. I came across Ink a few months ago and I was delighted with how small and concise it is. I can see this being a very interesting teaching language but it's also good to see that it has real life deployments too. Any thoughts about growing this beyond a personal project?


Ink in its current form/design has a few fatal flaws, mostly around poorly conceived syntax and semantics. I didn't notice it in design because I was new to designing a PL, but noticed them as I wrote a lot of software in Ink. These are pretty fundamental to the language so re-doing them would constitute a hugely breaking version change, but those changes are necessary I think for me to be confident telling other people to try it and use it. Some of these "flaws" I found are:

- I want real lists/arrays rather than Lua table-style data structures

- I need either pipelines (->>, |>) or class-style methods for ergonomics

- Testing and module system stories need a lot of work.

- Syntax quirks makes some kinds of nice constructs syntactically impossible or verbose (e.g. calling a fn defined on an object requires parenthesis to override the default order of operations)

I recently started hacking on a sort of "Ink 2.0" that preserves a lot of what I like about Ink (minimalism, lispy-ness, value rather than reference types, match expressions) without many of the design flaws. I might share and push that more publicly once I feel it's getting ready.


There's also Parity's "ink!" for writing smart contracts: https://github.com/paritytech/ink


monocle is insane! The results were blazing fast when I searched on your site: https://monocle.surge.sh


It's funny that lots of people comment on the snappy UI, because there isn't actually a lot of performance magic going on here -- the frontend just loads a few-MB large gzipped JSON inverted index and uses it to do all search and display locally in the browser using pretty normal unoptimized JavaScript. No WebAssembly or anything else fancy -- just JavaScript working through a large object graph.

I think in general simple JavaScript applications can be remarkably fast these days if you're careful not to introduce unnecessary work and aware of the data structures you're using and profile + optimize judiciously :)


For someone who care the implementation than the high-level design: It's written in go, interpreter-based, and pretty small [1].

Although the author seems to be a well-studied PL lover, you don't have to be like this to create a small language. It's fun experience and there are books for non-experts like [3].

- [1] https://github.com/thesephist/ink/tree/master/pkg/ink

- [2] https://thesephist.com/posts/pl/

- [3] https://interpreterbook.com/



+1 to both Crafting Interpreters, which is probably my favorite free online text about this stuff, as well as the Interpreter Book and Compiler Book, both written for Go as the implementation language. They were all a huge help for me learning the ropes initially.


Yeah, when I looked at the code I was like: "it's just like Go".


Sorry for the off-topic but can someone guide me about the roadmap/resource how one can make a toy/hobby language(even an intepretator language)? I might like to give it a try either in Python or Go and it could be a good excuse to refresh my compiler/language course I took 23 years back



There is a pair of books called "writing an interpreter in Go" and "writing a compiler in Go" If I remember their names, pretty accessible.

There is also the outstanding "Crafting Interpreters" by Robert Nystrom, this book and its author hold a very special place in my heart. Before I read this book I was stuck at the "+-*/ calculator" level in compilers and interpreters, intimidated by the depth and breadth of further material. This book teaches you how to make a full blown scripting language with first class closures and classes, first as an interpreter running on java (high level enough to get the intimidated beginner started and focused on the task, yet still a challenging learning experience) then as a {bytecode compiler, VM} pair in C be because this is how all the cool kids write their interpreters and compilers. Accessible if there was ever such a thing in the world, I mean it : if you understand how linked lists, hash maps and trees work, you're good to go. The icing on the cake is that the whole thing is free on a website by the same name the author made, the same thing he did with his other book about Game Programming Design Patterns, it's an astonishing act of charity, I really wish to meet this guy. An awesome personality and a great teacher. You will remember his voice and manner of speech for a lot of time.

There is also the book "elements of computing systems" aka "From Nand To Tetris", where the authors walk you through creating a full computing stack from the NAND logic gate to the OS. Starting from chapter 6 through 11, you write an assembler for the hardware, then implement a VM running on the assembler, then implement a java-like language on top of the VM.

These things are just off the top of my head, there is a massive trove of material in YouTube and the rest of the Internet.


I learned best in Scheme because you don't need to parse your input and can just evaluate a tree[0] (Parsing is, in my opinion, the most boring part about writing an interpreter!)

Chapter 7 of Crafting Interpreters lays out how an evaluator works in a pretty clean way [1]. I've also blogged about evaluating ASTs in JavaScript [2]

Lastly, Gary Bernhardt took it a step further and instead of "evaluating" code, "compiled" it to JavaScript (this tutorial uses Ruby) [3]. Very much a mind-blown moment for me.

Have fun!! Writing interpreters remains one of my favorite things to do when learning a new programming language.

[0] https://www.youtube.com/watch?v=aAlR3cezPJg

[1] https://craftinginterpreters.com/evaluating-expressions.html

[2] https://thatjdanisso.cool/programming-languages

[3] https://www.destroyallsoftware.com/screencasts/catalog/a-com...


Implementing a Webassembly interpreter in python for fun: https://youtu.be/r-A78RgMhZU


Another link, that I picked up from some other HN thread: Resources for Amateur Compiler Writers https://c9x.me/compile/bib/


"The elements of computing systems" aka "Nand to Tetris" takes you through the process and I could understand it despite not having a degree. Highly recommended.


There is another ink language https://www.inklestudios.com/ink/


@thesephist, I have friends in West Lafayette. If you'd like I'll buy you a cup of coffee when I'm over that way!


I'm usually in NYC these days, but WL is my hometown. Appreciate the offer! Maybe we'll meet up in NY instead :)


Mods please change title to “Ink programming language” (currently says “Dot Ink...”).

The language is called “Ink”; “dotink” is just the domain name.

As also mentioned in the author’s comment: https://news.ycombinator.com/item?id=27798704 .




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: