9 ms·
Lang Jam: create a programming language in a weekend
- agalunar 5y agoIf you're looking for similar hackathons, you may be interested in https://quirkylanguages.com/ https://quirkylanguages.com/
- rodrick_setsoff 5y agoNice! I guess I've got to face ASTs again:)
- jhgb 5y agoWrite a Forth. ;)
- codr7 5y agoOr a Lisp and let the user face them instead.
- jhgb 5y agoForth seems easier to do over a weekend, though.
- stevekemp 5y agoThere's even a recipe posted in a couple of comments here: https://news.ycombinator.com/item?id=13082825 https://news.ycombinator.com/item?id=13082825 I followed that guide to implement a simple FORTH-like system in golang: https://github.com/skx/foth https://github.com/skx/foth As I was following the implementation recipe I broke it down into "educational steps". Although it isn't a true FORTH it is pretty easy to understand and useful enough to embed inside other applications. Now and again I consider doing it again, but using a real return-stack to remove the hardcoded control-flow words from the interpreter, but I never quite find the time.
- codr7 5y agoDefinitely easier; it has no structure at all, it's all in your head/stack. https://github.com/codr7/fipl https://github.com/codr7/fipl
- Karsteski 5y agoIt would be very fun to participate in this! How much experience would one need to be useful as part of a team though?
- lioeters 5y agoLooks like a lot of fun! I hope I get to see what people will come up with.
- 0b01 5y agoMore like parser jam
- brundolf 5y agoI don't see how? > You can build an interpreter or a compiler, so long as it can run or build examples of code in the programming language you create.
- diogenesjunior 5y agoMaybe I'm not reading correctly, but it seems the project is about making a language compiler and not a language itself?
- Mikeb85 5y agoFrom the site: > You can build an interpreter or a compiler, so long as it can run or build examples of code in the programming language you create. No you create a language, but it needs to be able to run. So need to either build a compiler or interpreter to make the language do things.
- spdegabrielle 5y agoWhat’s the difference?
- hazbo 5y agoWhen you think "language", try not to let your mind jump straight to "compiler" or "interpreter". Think more, "specification". If I asked you to write me a C compiler and you delivered on that, I'm not left with a new language. You didn't design a new language, only the compiler for an already specified language. Designing a language is more about defining a specification. Then 10 different compiler engineers may pick that spec up and implement 10 different implementations of the same language, for example.
- mepian 5y agoSounds like a really good use of Common Lisp and Esrap.
- yellow_lead 5y agoJavaScript was made in a weekend, wasn't it?
- m_arnold 5y ago10 days, IIRC
- y2bd 5y agoEven more motivation to give it a shot! Certainly you can’t do any worse ;)
- breck 5y agoBut took 25 years to make ES6 ;)
- userbinator 5y agoJ certainly was: https://code.jsoftware.com/wiki/Essays/Incunabulum https://code.jsoftware.com/wiki/Essays/Incunabulum
- bbojan 5y agoTen days, to be more exact.
- codr7 5y agoI've been working on a toolkit for creating interpreted languages, right now I'm liking Swift a lot as host language: https://github.com/codr7/swifties https://github.com/codr7/swifties
- codetrotter 5y agoAs someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other code I work on takes precedence at the moment.
- breck 5y agoHaven’t looked at the rust compiler code base, but often with languages you can hack together subsets via deletions and comments and flags of existing compilers.
- tyingq 5y agoMaybe some ideas here: https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc
- amelius 5y agoWhy would someone write a bootstrapping rust compiler in C++ when you can just compile the rust to C using a proper llvm backend?
- fouc 5y agoWhat kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]
- neysofu 5y agoThe usage of `unless` strikes me as unmaintainable and "smart", not in a good way tbh. The types are all other the places, too. What is it even doing exactly? Appending a string to a null value..?
- zamadatix 5y agoAs is it's just doing the first 100 iterations of fizzbuzz as either a number or text depending on the fizzbuzz step but not printing or saving anything. If you wrap it in a console.log() it'll create a 100 element array of objects which are the answer for fizzbuzz[index+1] and log them. All that said I've never been a fan of dynamically typed languages myself. Fast to make things in but difficult to reason about later.
- mhio 5y ago> Appending a string to a null value..? Appending a string to an undefined value, via array addition, which turns them into strings but doesn't turn null into 'null' or undefined into 'undefined'. It's a bit of a hack. `'a' + undefined === 'aundefined'` `[ 'a' ] + [ undefined ] === 'a'` Also the empty string '' evaluates to false. `[ undefined ] + [ undefined ] == ''` This is wat - https://archive.org/details/wat_destroyallsoftware https://archive.org/details/wat_destroyallsoftware
- azhenley 5y agoReminds me of the PLTGames from years ago. It didn't last that long. https://twitter.com/pltgames https://twitter.com/pltgames
- Amin699 5y agoYou can code in any programming language you'd like to create your project, so long as the language is part of the Debian/Ubuntu or Arch package repo (or one of the language-specific repos, like Rust's cargo). Please limit build steps of the project to three or less steps.
- spdegabrielle 5y agoWould it be cheating to use Racket? https://racket-lang.org/ https://racket-lang.org/
- cdrini 5y ago> You can code in any programming language you'd like to create your project, so long as the language is part of the Debian/Ubuntu or Arch package repo (or one of the language-specific repos, like Rust's cargo). So seems like it should be fine! Go ahead and make a racket :)
- mustknow2201 5y agoThis looks cool. My most recent attempt at language creation was a bit esoteric, for code golf [0] [0] https://github.com/Slord6/Spice https://github.com/Slord6/Spice
- dangoor 5y agoCrafting Interpreters came out just in time for this :) http://craftinginterpreters.com http://craftinginterpreters.com
- Melonai 5y agoHadn't heard of this book yet! From my cursory glance this looks like quite a good introduction into language implementation, which is just what I've been looking for myself, thanks a lot!
- cweagans 5y agoYou should definitely check out https://interpreterbook.com/ https://interpreterbook.com/ and https://compilerbook.com/ https://compilerbook.com/ too. They're very well written and very thorough. Highly recommend them as approachable primers on the topic.
- rmetzler 5y agoI could use something similar to jq, but for XML. Or something like a lovechild of sed, awk, seq, and cut, with regexp match groups and string interpolation.
- benibela 5y ago> I could use something similar to jq, but for XML. That would be XPath/XQuery I have spent 15 years implementing that in Xidel >Or something like a lovechild of sed, awk, seq, and cut, with regexp match groups and string interpolation. Sounds like Perl
- rmetzler 5y agoThe argument that you can express something in an existing language doesn't mean you shouldn't try to create something more expressive.
- benibela 5y agoThey are making new languages far too often It started with XPath, then came XPath 2, then XQuery 1, then XPath 3.0 and XQuery 3.0, and then XPath 3.1 and XQuery 3.1. Six new languages each more expressive than previous one. That is why it takes forever to implement them. And now people are working on XPath 4.0 and XQuery 4.0. And Perl got Perl 6 and Perl 7 and Raku
- rmetzler 5y agoMayby they should work on a new language with a new name instead of stuffing features in existing languages? And let users decide what they like better? And this is a post about creating lots of new languages. This doesn't have the goal of having languages that run in production, it has the goal of exploring the solution space.
- miccah 5y agoDoes anyone have a good resource on writing compiled languages? I'd like to join this Jam but I don't know where to start.
- tincholio 5y agoAnd that's how we get another javascript...