My brother just finished writing a forth like interpreter for a freshman CS project (in java, not Bash, thankfully). It is a really nice language for learning the basics of an interpreter without worrying about the parser side too much.
Forth is a really nice language for learning raw machine code then adding an assembler then moving up to a HLL in a few printed pages of code. The ultimate macro assembler. Back in 1986 teenage me found this library book that described Forth as "a ball of mud" which later made sense. A small core of machine specific bits form the core, you have to make that by hand. Then you accumulate and write an assembler on top of that. Then there's the I/O and logistics of the system. Then there's the whole interpreter/compiler all the same. It's the ultimate bootstrap. From laying down bytes in memory to a hybrid interpreter/compiler that you can say "take this word and make it a thing" and it can fart out this little polished turd.
Forth is bottom up insted of top down. The concepts teaching/learning wise start at the bottom and lead up to the top. You can't learn that starting with Python or Fortran or C or BASIC, or even Assembler. Bottom up.
Forth might not be the best Pascal/Basic/Python learning some stuff language, but Forth is the best bits in memory to HLL "full-stack" language.
I wish your brother had done it on raw hardware instead of in Java. It is a really nice language for learning.
although there are a lot of whitespace and comments to get up to ~3800 lines.
The biggest shell scripts in the world seem to be about 10x bigger, around ~30K lines. Feel free to add any "program" that's more than 10K lines, and smaller ones if they are "interesting". (That's subjective, but I think a Forth qualifies.)
Tangentially related, but I have found making good use of local, functions, and jq (for structured data) makes large bash programs significantly more viable.
The nice thing about using bash is it implies the program is intended to be quick and dirty, and easy to deploy. Users might have to get their hands dirty- and they can since it is interpreted and interactive. Code reviewers usually respect this and don't hang you out to dry.
Can someone explain to me why people are writing complex systems in Bash? It seems to be somewhat of a joke/meme, but I am having a hard time understanding why someone would put so much effort into a joke. Another recent example: https://news.ycombinator.com/item?id=29648135
Same reason why people write non-trivial programs in any of the esoteric languages ... in part it's a challenge, in part it's a demonstration of cool techniques, and in part it's a demonstration of your skills.
For them it's fun, for the readers it's a view into a weird world. Maybe it's just not for you, but not everything has to be for you.
Are you saying there is credibility/virtue in making something deliberately difficult to build, read, and maintain, in the absence of real constraints?
Part of what attracted me to technology, computers, programming, etc is the ability and freedom to tinker and experiment with ideas.
If I’m building something professionally, then difficulty in building, reading and maintaining is a problem.
If I’m building something to learn or to be creative, I don’t worry about how difficult it is to build or read or maintain: my aim is different, and therefore so are my concerns.
Are you saying that there's no value in demonstrating the skill to create something that many, perhaps most, programmers would say is impossible?
Have you looked at the code? It's beautifully laid out, extremely readable, and completely maintainable. If you don't know bash it's a great example of how to create a reasonably complex program that's designed to be read and maintained.
And finally, yes, when taken as an opportunity to improve your skills, absolutely there is value in creating something as a vehicle for developing your abilities, to demonstrate to others that you have those skills, and quite simply, as a challenge.
I don't think most or even many programmers would say it is "impossible" to write a Forth interpreter in Bash. If you changed "impossible" to "worth the effort", I would agree. For the same reason it's (in the absence of real constraints), it's not worth the effort (nor impossible) to write a Forth interpreter with a hex editor.
From an interviewers perspective of "value", I would be both impressed at the perseverance demonstrated, but horrified at the deliberate masochism.
>completely maintainable
This is far less maintainable than a clean Forth interpreter written in Java. Maintainability is relative, so saying that something "is maintainable" has no meaning unless you compare it to something else.
>absolutely there is value in creating something as a vehicle for developing your abilities
I agree, but applying that to this is like saying "let's learn to build a house by using a hammer that has no handle, and a saw that is made out of raisins."
Perhaps I'm reading you wrongly, but everything you are saying here and elsewhere implies to me that you take the attitude that everything you do must have value to other people in the world.
Do you do crosswords? Sudoku? Wordle? Do you play chess? Go? Backgammon? Do you play any video games? Do you watch movies? Do you play a musical instrument? Do you paint or draw?
If so ... why? What value do these provide for the rest of the world?
If not, fair enough ... that's just you, and maybe you won't ever understand that sometimes other people do things purely for the challenge, and sometimes on the way these things hone skills, increase knowledge, and provide satisfaction.
I think we are talking past eachother. I don't play Sudoku without writing, or chess using only my pinky toe, or video games with a glitchy controller, or watch movies backwards, etc. There is a difference between doing X for pleasure/learning, and doing X as difficultly as possible for the sake of being difficult. Maybe my point would be more clear about this project, if instead of using Bash, it was "using only GOTOs and single-letter variables."
Well, I guess I just don't understand your question. They've implement a Forth interpreter in a programming language. I don't see why you equate this with using hammers without handles, or saws made of raisins, or doing sudoku without writing.
Using bash is perhaps unexpected, but it's not like writing machine code in raw, unadorned, inscrutable hex by toggling bits in through a front panel.
It's just a programming language, and it's interesting and instructive to see the end result, unlike watching someone playing chess with their pinky.
I don't see why you think it's so bizarre. It's not doing it in a way that's as difficult as possible .. really, it isn't.
But ... I guess I just won't understand your question.
Compare it to learning to ride a unicycle. Sure, it's a lot of effort, and bicycles are better in every practical way. But some people put a lot of time into it and find it fun, and that someone has done it is impressive even if you wouldn't go through the trouble yourself.
Maybe that is the part I am misunderstanding. I'm an experienced engineer and I code for fun, and think that coding a Forth interpreter (or any interpreter) would be fun, but have a very hard time believing that "fun" (versus "trying to impress people") is the primary motivator to using Bash to code an interpreter.
But I acknowledge that I could be wrong too. Maybe they had a blast using Bash.
Why not solve a real world puzzle then? To me, it's kind of like deliberately spilling a bag of sand on the floor, then toiling by picking up each grain with tweezers. Sure, it is difficult, and nobody can deny the work that you did, but you also created the work and the constraints yourself.
I think I just don't "get it" and my pov is probably colored by frustrating interactions that I have at work where people do the similar things in code shared by others, to (seemingly) demonstrate "their skills."
Advent of Code is different, unless one of the requirements is you make your solution as obfuscated and esoteric as possible, which is rarely in a code challenge (the IOCCC being an exception). In Advent of Code, you're still trying to solve problems efficiently.
After looking at the other repositories in their account I get a sense that here’s somebody trying to test his knowledge by explaining it to someone else. In this particular case the knowledge of Forth and that someone else being Bash.
Also, for me, there’s a certain power that ubiquitous readily-available technologies like Bash have and I enjoyed browsing through what I see as an honest and clean exploration of its possibilities.