Live data from Hacker News

What you learn by making a new programming language

ntietz.com

71–80 of 137 posts

Re: What you learn by making a new programming language

#71
post #11

Earlier quoted context omitted.

> Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule

Is this a joke I'm not getting? Any examples of such software?

The joke is that C and C++ lack important features found in Common Lisp, so real world programs end up adding those features indirectly as the size of the program grows.

Re: What you learn by making a new programming language

#72
post #13

I've had two projects that end up being "oops, I made an interpreter". It starts innocently enough, you just have a JSON that has some basic functionality. Then you decide it would be cool to nest functionality because there's no reason not to, so you build a recursive parser. Then you think it'd be neat to be able to add some arguments to the recursive stuff, because then you can more easily parameterize the JSON. T…

This happened to me with an XML based rules engine I wrote. First I needed conditions, then I introduced variables, then loops, then if-then-else. When I needed to handle errors, I realized that I just had invented something like BASIC in XML format. The interpreter was surprisingly short and concise mainly because XML ensured I didn't have to do the parsing.

Switched to dynamically compiled C# eventually.

Re: What you learn by making a new programming language

#73
post #5

Earlier quoted context omitted.

Angry upvote. Maybe it's true failing though was stopping short of becoming the OS.

It's not its own kernel, but emacs can run on Linux as PID 1, at which point it rather seems like it should count as an OS. Given its affiliation, emacs/Linux probably still counts as GNU/Linux, but still...

Maybe a potential use case for GNU Hurd?

Re: What you learn by making a new programming language

#74
post #70

> It will be a bad language, and that's okay This same advice could be applied to most hobbies. It doesn't have to be good, and it certainly doesn't have to make money. It just has to be fun and rewarding. If you learn something, even better. > Go Forth , make something fun *golfclap*

And here's my tutorial FORTH, based upon a thread from hacker news:

https://github.com/skx/foth

Forth is always appealing, whether literally, or in puns.

Re: What you learn by making a new programming language

#75
post #11

Earlier quoted context omitted.

> Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule

Is this a joke I'm not getting? Any examples of such software?

I think the initial intent of the quote was to ridicule non-lisp users for reinventing the wheel, but to me it always reads as a fundamental misunderstanding of the fact that programming language constraints are _features_ rather than downsides.

Re: What you learn by making a new programming language

#76
post #14

I've dreamed about making my own language for about 10 years or so. Started out just messing around. My vision for what it would be and its purpose has changed over time. About 2 years ago, I "got serious" about designing and implementing it, though that doesn't mean I've spent a serious amount of time on it yet. But it's happening! It's a language for the domain of writing and verifying formal proofs. Basically, I d…

Sounds neat - got any example code you could share?

Not ready to do that yet. But I hope so one day!

Re: What you learn by making a new programming language

#77
post #48
post #13

I've had two projects that end up being "oops, I made an interpreter". It starts innocently enough, you just have a JSON that has some basic functionality. Then you decide it would be cool to nest functionality because there's no reason not to, so you build a recursive parser. Then you think it'd be neat to be able to add some arguments to the recursive stuff, because then you can more easily parameterize the JSON. T…

Likewise, I've done that more times than I'd like to admit. And I took it a step further with an LLM like a month and a half ago fenced behind a number of json and yaml instructions, containing conditions and validators. It works like a charm but yeah... Oops, I did it again.

> Oops, I did it again

I played with `eval`, got lost in codegen: O(AB), maybe?

Re: What you learn by making a new programming language

#78

One of the most fundamental experiences I ever had was attempting a graduate level course at the end of a long series on compilers. You really get an eye opening view of how languages are translated into the language the machine understands. After going through a few toy languages and then finally tackling creating a simple JVM, here is the #1 thing I would go back to myself and scream until I was blue - Make your in…

I've been working on a toy compiler on-and-off, which is basically just a "reinvent-the-wheel simulator" since I really haven't looked at much existing literature. A very janky, bug-prone part of it is a sort-of mini parser generator, which you can feed a dictionary of rules (as strings) to. This, while slowing down the compilation speed, has allowed me to expand the grammar incrementally from dead simple to more complex, which has been a nice thing.

Re: What you learn by making a new programming language

#79
post #70

> It will be a bad language, and that's okay This same advice could be applied to most hobbies. It doesn't have to be good, and it certainly doesn't have to make money. It just has to be fun and rewarding. If you learn something, even better. > Go Forth , make something fun *golfclap*

And here's my tutorial FORTH, based upon a thread from hacker news: https://github.com/skx/foth Forth is always appealing, whether literally, or in puns.

Very cool, I'll check it out. I've been meaning to give Go a spin.

Re: What you learn by making a new programming language

#80
post #11

Earlier quoted context omitted.

Is this a joke I'm not getting? Any examples of such software?

It's a famous quote and it is of course meant to be humorous, and a statement of how vast the functionality of common lisp is (huge spec and book)

I'm not sure I'd call it "huge" anymore, when the C++ specification (at least, this one from 2020) is 1841 pages long.

https://isocpp.org/files/papers/N4860.pdf

Post reply on HN