Ask HN: Resources for building a programming language?
41–50 of 87 posts
Re: Ask HN: Resources for building a programming language?
#42Using Forth as a substrate lets you focus on the more interesting aspects to an even higher degree than Lisp. The last thing you want is detailed instructions; unless you're just building another whatever, which never really made sense to me. Build the most simple and naive thing possible that works the way you want it to, and go from there. That's how Snabel was born: https://github.com/andreas-gone-wild/snackis/blo…
Therein lies my problem with Forth. Yes there is a ton of power, but that is inaccessible to a lot of users. I know I can look at Jones Forth & MeCrisp, but I honestly couldn't see where to start. I'd like to see a tutorial start with either an assembly or C base and then teach Forth fundamentals such as how to start your dictionary and choose between direct/indirect threading and how to implement each. I'm always cu…
For threading, this is probably a good start: https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Thr...
EDIT: I don't know how well you know Forth, but it's probably a waste of time trying to implement it before you grok it from userland, if that's where you are. Understanding first the concatenative paradigm and then (more importantly) the deep metaprogramming runtime-is-a-fundamental-part-of-your-application paradigm (which Forth shares with Lisp and Smalltalk) is super important
Re: Ask HN: Resources for building a programming language?
#43Here's the language I'm building: https://github.com/kevwu/kythera
Re: Ask HN: Resources for building a programming language?
#44Here's a cool programming language in a live-coding environment that I developed with my interns two summers ago. It enables natural language programming which is great for introducing young kids to computer science. It is built in Java and uses a recursive descent parser to parse sentences like "draw a red circle at 300, 300", and is well commented because the intention was for advanced students at my education prog…
A useful question: you want to talk to a computer conversationally, and get beyond the Alexa/Siri level of tasks. How would you do that? Fully general natural language requires strong AI. Could you come up with some more restricted form with enough expressive power but understandable by a computer? The computer might have to rephrase your questions and ask "did you mean...?" Come up with a way to converge when the understanding is poor, and you'll have something.
Re: Ask HN: Resources for building a programming language?
#45Most of the responses so far are about implementing. My favorite intro to programming languages was http://www.eopl3.com/ (though the first edition was more fun and not quite so focused on being a classroom textbook). Working through it, you write interpreters, but that's to make the ideas concrete and testable, not to replace a compilers class. There are newer books that may be better -- I hope someone who's studied…
The second and third editions feel less "hard core" somehow.
Re: Ask HN: Resources for building a programming language?
#46While I'm here, does anyone know of any practical resources on how to implement LLVM languages with GC? The documentation [1] leaves something to be desired.
[0] https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_...
Re: Ask HN: Resources for building a programming language?
#47You'll want the Dragon Book as a reference, not necessary to get started with, but to build the semantic tree on which you will need to pin concepts on. https://www.amazon.com/Compilers-Principles-Techniques-Tools... If you aren't yet committed to any language, you can start building a parser with PyParsing. It's really easy. http://pyparsing.wikispaces.com/ If you want to take a quick (albeit expensive) class on it,…
Hmm. This might be kind of blasphemous, but I think I'd recommend against the dragon book? As I remember, the emphasis in that book is on syntax-directed translation. I might argue that the less you're thinking about syntax and lexing/parsing crap the better. (For that reason: ignore other answers that tell you to learn about a particular parser generator (e.g. ANTLR). That's just fluff.) Really, if you're coming to…
OP asks for resource to build a language. The Dragon book is a very good book to cover the whole process.
Re: Ask HN: Resources for building a programming language?
#48https://interpreterbook.com is a pretty good resource to hit the ground running, with unit tests and little magic. Once you've gone through it, you'll probably want to use the magic tools as they're well tested at this point, and make your life easier. Still, understanding what they're doing for you is a massive boon. I should note, it uses Go but not in an idiomatic way. Strings instead of using an error type, etc.…
I'm also super curious about your "not in an idiomatic way" comment. If you have a minute, feel free to send me a longer version - me at thorstenball.com. I'd really love to hear what you'd do differently and what could be more idiomatic.
Re: Ask HN: Resources for building a programming language?
#49I strongly suggest you build something esoteric and fun first. This should be a "bare minimum" VM or interpreter. Here's one of mine that I wrote like a 8 years ago[1]: https://github.com/dvx/zeded/ Don't start off with YACC/Bison as they hide a lot of stuff under the hood. It's cool learning things from scratch. The most commonly-suggested book on compilers is known as the Dragon Book [2] and if you want to take thi…
For the dragon book, the first edition is significantly cheaper. Is there anything in the new version making it worth over 10x as much?
Re: Ask HN: Resources for building a programming language?
#50There are lots of small, comprehensible compilers and interpreters there, and there is an interpreter and runtime construction kit, look for "S9 core" in http://t3x.org/s9fes/. You can also order books explaining all the stuff. And yes, I'm the author! :)