Hacker News new | ask | show | jobs
by posix_monad 695 days ago
Building a language is too hard.

You need to create:

- Grammar, parser, compiler, interpreter (delete as appropriate)

- Editor plugins for nice syntax highlighting

- Language server

- Packages for common things

- Nice website (or no one will use it)

- etc...

So the pressure is always to shoe-horn a big existing language into you problem. Maybe you can build a nice library if your language has decent syntax (or little to no syntax). If you have an AST representation, you probably dump it to JSON etc.

I am curious if any projects are trying to make this easier.

3 comments

Charles Simonyi and his Intentional Software tried to solve this, publishing some interesting articles in the 1990es. However their technology was not broadly used and they were acquired by Microsoft.

The key ideas are called Intentional Programming and Language Workbenches.

The best accessible implementation of that is JetBrains’ MPS (it is free). It allows you to define a language and “projectional” editors together.

It is really fascinating but it suffers from a learning curve where there is no small step from what people use in their everyday common languages and IDEs to building domain-specific solutions with MPS, so adoption is low.

Markus Voelter has some highly recommendable publications and elaborate applications of MPS for domains specific languages, see http://voelter.de/

I am sure there is something great in that area but it has not found the right form and shape yet, so keep exploring.

Very Nice.

A rare mention of Intentional Programming aka IP (https://en.wikipedia.org/wiki/Intentional_programming) on HN. I first came to know of this from an article by Charles Simonyi titled "The Death of Computer Languages, The Birth of Intentional Programming" on MSDN. But alas, the promise never came to pass. The only other place i know of which covers it is a chapter in the book Generative Programming Methods, Tools, and Applications by Krysztof Czarnecki et al. IP is rather hard to understand (i still don't get it completely) and afaik there are no publicly available tools/IDEs to learn/play with it.

I don't believe Jetbrains MPS is a IP programming editor, it is meant for designing DSLs. IP has aspects of a DSL but is not the same.

Finally a huge upvote for mentioning Markus Voelter who is THE Expert in DSL design/implementation/usage. Checkout his articles/essays and the free ebook "Domain Engineering: Designing, Implementing and Using Domain-Specific Languages" from his above mentioned site.

The original Intentional Programming in the mid-nineties was a much broader vision than Language Workbenches, more like a grand unified theory of software development and related tools such as IDEs, languages, compilers, and a marketplace of components in that space.

My understanding, from the demos they were giving around 15 years ago, is that the Intentional company ended up focusing on a smaller feature set similar to MPS (I don’t have personal development experience with the Intentional product, only MPS).

It would be interesting to learn more about their work and lessons learned.

Federico Tomassetti is also good. Check out his blog: https://tomassetti.me/blog/
Thank You. Seems like a expert "Language Engineer" worth learning from.
MPS is pretty cool but goddamn dod I hate projection.

Something that in theory sounds good but in reality means you have to build a bunch of extra tooling around it.

Feel like just text will be the way to go for a long time.

GraalVM's Truffle languages try to make this easier. You still have to write a parser and an interpreter. But from these you get a compiler for free. Plus tools like a debugger, I think maybe a language server as well. And your language can easily call out to the Java standard library, which solves the problem of standard packages. But you're tied to Java.
Building a small language is super easy. You can even just use JSON as a functional but ugly stand in for the syntax. However I usually just write a quick recursive descendant parser. It is easy and quick to do once you know how to do it.