8 ms·
Little Languages
- greenyouse 8y agoI worked through the CTM book[0] a while ago and I think this was the general approach taken using the Oz programming language. Each programming paradigm was split into a kernel language that would demonstrate specific programming features. I'd highly recommend trying it out. I really like the diagram they use to split up the languages + paradigms[1] [0]https://en.wikipedia.org/wiki/Concepts,_Techniques,_and_Models_of_Computer_Programming https://en.wikipedia.org/wiki/Concepts,_Techniques,_and_Mode... [1]https://www.info.ucl.ac.be/~pvr/paradigmsDIAGRAMeng108.jpg https://www.info.ucl.ac.be/~pvr/paradigmsDIAGRAMeng108.jpg
- bcherny 8y agoWhat an interesting idea. Sort of, isolate out a graph of concepts from a language, and pull it out into its own language. I do wonder why the author believes you need a separate language for this. Why not a DSL, or even a regular library in your popular language of choice (Scala, Haskell, JS, etc.). Is that a reasonable approach too? Or is some part of the toy language approach lost without perfect domain-specific syntax, or because of parts of your host language leaking in?
- joppy 8y agoIsn’t a DSL a separate language? Libraries sometimes cannot do what new languages can, or can only mimic it in a very very cumbersome way, I think this is why the author advocates for separate languages, rather than libraries. The other thing that a separate language allows is for the author to remove every distraction that a host lanauge might have, and really streamline and emphasise the concepts they’re trying to show, and those concepts only.
- johncalvinyoung 8y agoAs a developer who loves Ruby, the article (or possibly someone's comment above about making a mini-language around monads) reminded me of an excellent talk I heard lately that implemented a DSL/object model for monads in Ruby, and refactored some moderately sticky problems to use them. Still didn't convince me that they were the One Holy Way to do my next project, but got it a whole lot closer to a tool in my toolbox. I think the reasoning behind implementing these small languages on their own would be twofold: one, unless you're very careful, you end up with lots of context and approach and style inherited from your host language. You can write non-rubyish Ruby, but only to a degree...and anyone using it who's moderately familiar with the language is likely to break your artificial constraints. And for many of the programming concepts perhaps best demonstrated in isolation, they're divergent enough to be hard to implement well in a 'traditional' host language.
- sharpercoder 8y agoI'm very fond of small, specific and simple languages without sacrificing inherent complexity. For me, that includes IP adresses, UUIDs, timestamps, URIs, println formatting, et cetera. It's a shame though that we don't represent them as such in the current state of affairs but choose to implement them separately in every language. Can we have a fast, universal, feature complete parser generator that is natively supported in our mainstream languages? For instance, think adding an ANTLR grammar into a .NET project and then be able to just do `var ipAddress = ip"127.0.0.1";` and get full editor support with that.
- wcrichton 8y agoTyped literal macros [0] are a principled way of integrating these kinds of mini-languages into a bigger general-purpose language. [0] https://github.com/cyrus-/relit https://github.com/cyrus-/relit
- nathell 8y agoClojure (and EDN) has it in the form of tagged literals. https://clojure.org/reference/reader#tagged_literals https://clojure.org/reference/reader#tagged_literals
- thosakwe 8y agoI’d love if it were ANTLR. I think it already has much in the way of support for multiple languages (I’m still working on a Dart port, and I encountered someone who has ported it to D). At the end of the day, I guess it might just boil down to surrounding tooling.
- herrosheep 8y agoThis is a cool idea, like an inverse Rosetta Stone.
- aasasd 8y ago> and get full editor support with that Pretty sure that if you want anything more than syntax highlighting, you'll need way more than just grammar.
- fulafel 8y ago
- jsnell 8y agoI was expecting this to be about http://wiki.c2.com/?LittleLanguage http://wiki.c2.com/?LittleLanguage But instead it's almost the opposite. Bentley's original use of the little language term was about optimizing the languages for specific tasks. Not about building them around explaining a single concept
- mmphosis 8y agoHere's another one: http://www.erasmatazz.com/library/the-journal-of-computer/jcgd-volume-9/little-languages.html http://www.erasmatazz.com/library/the-journal-of-computer/jc...
- yogthos 8y agoScheme sounds like it's pretty close to what the author is describing. It's a very small and simple core that you can build on, and even create mini languages on top of. The macro system allows you to pretty much express any idea without having to change the core language. As a bonus the runtime is interactive allowing you to explore ideas and see the results immediately.
- deleted 8y ago[deleted]
- herrosheep 8y agoForth is also quite amazing. I really enjoy both.
- blattimwind 8y agoLua always seemed somehow "right" to me (despite its numerous flaws, including one-based indexing), just like s-expressions somehow are just the right format for many kinds of data. You look at it and "just know". You understand it, the computer understands it effortlessly, and if you remove any element it stops making sense. One thing both of these have in common is that they are slightly different from mainstream ideas (e.g. C, Python, JSON, XML). Not so different it becomes alien, but different enough to make you approach it with a different state of mind.
- airstrike 8y agoI'm not a Lua user, so I thought I'd ask why one-based indexing is a flaw. As long as it's consistent, does it really matter? As someone who is forced to use VBA, it sounds like Lua could be worse
- jonsen 8y ago“Why numbering should start at zero”: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW...
- aasasd 8y agoWikipedia knows of this thing called XL, or ‘Extensible Language,’ though I haven't seen it anywhere else: https://en.wikipedia.org/wiki/XL_(programming_language) https://en.wikipedia.org/wiki/XL_(programming_language) > XL features programmer-reconfigurable syntax and semantics. Compiler plug-ins can be used to add new features to the language. A base set of plug-ins implements a relatively standard imperative language. Programmers can write their own plug-ins to implement application-specific notations, which can then be used as readily as built-in language features. > XL is defined at four different levels: XL0 defines how an input text is transformed into a parse tree. XL1 defines a base language with features comparable to C++. XL2 defines the standard library, which includes common data types and operators. XLR defines a dynamic runtime for XL based on XL0. > XL has no primitive types nor keywords. All useful operators and data types, like integers or addition, are defined in the standard library (XL2). XL1 is portable between different execution environments. There is no such guarantee for XL2: if a particular CPU does not implement floating-point multiplication, the corresponding operator definition may be missing from the standard library, and using a floating-point multiply may result in a compile-time error. Frankly, I'm not sure if this is much different from implementing a language with a parser generator, but apparently the ‘semantics plugins’ are written in a version of the language itself, instead of something like the eternal C[++].
- panic 8y agoAndrej Bauer maintains a “programming languages zoo” of languages like this: http://plzoo.andrej.com http://plzoo.andrej.com > The Programming Languages Zoo is a collection of miniature programming languages which demonstrates various concepts and techniques used in programming language design and implementation. It is a good starting point for those who would like to implement their own programming language, or just learn how it is done.
- jnbiche 8y agoThe PL Zoo is a great resource, but that's not exactly what the blog post is advocating for. PL Zoo is meant for students studying the implementation and design of programming languages. What the blog author is describing, on the other hand, is a small language for teaching the use and application of certain programming techniques. It's a very promising idea, one that I may try to bring to life for something tricky, like monads or maybe Rust's ownership system.
- chongli 8y agoWhat the blog author is describing, on the other hand, is a small language for teaching the use and application of certain programming techniques. They already exist: the Racket student languages. My first year CS course was built on them [1]. Really well-made and -run course. [1] https://www.student.cs.uwaterloo.ca/~cs135/ https://www.student.cs.uwaterloo.ca/~cs135/
- maxhallinan 8y agoThanks for mentioning Racket. I'm aware of the language but didn't know it know it was designed specifically for "language-oriented programming".
- maxhallinan 8y agoYou're right, these languages have a slightly different aim but it's exactly the same motivation.
- maxhallinan 8y ago
- kccqzy 8y agoWhen I first read the title, I thought the article was about awk. After all the definitive book about awk has a whole chapter on little languages. In that context, little languages means languages with specialized applications, and not general-purpose.
- sn41 8y agoHmm. I wanted to offer a course based on Idris this time around, and found that I would have to cover a lot of Haskell to get to the main parts of Idris. As I was about to teach this semester, somebody pointed out the new book "The Little Typer", along the lines of "The Little Lisper" and "The Little Schemer". Looks like Pie is a toy language in "The Little Typer". Pie looks promising - I'll dig in and spend a weekend on it :)
- xellisx 8y agoDoes brainfuck count as a small language?
- maxhallinan 8y agoBrainfuck certainly is small. I think it might also be an example of what I had in mind. Brainfuck could be a little language for the idea of a Turing machine. Perhaps by writing Brainfuck programs, one better understands the mechanics of the Turing machine.
- pgtan 8y agoWonder, how everyone forget BibTeX, the (stack based) language for formating bibligraphy databases: http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/biblio/bibtex/base/btxhak.pdf http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/b...
- a-saleh 8y agoIn my mind, there are three really great little languages: * datafun - attempt to extend datalog to more generic computation. http://www.rntz.net/datafun/ http://www.rntz.net/datafun/ I liked simillar exploration of computing with latices with the concept of propagators: http://web.mit.edu/~axch/www/art.pdf http://web.mit.edu/~axch/www/art.pdf * dhall - configuration language that has user defined functions, but is total :) https://github.com/dhall-lang/dhall-lang https://github.com/dhall-lang/dhall-lang * the gamma - a visualization/data query language : http://tomasp.net/blog/2017/thegamma-getting-started/ http://tomasp.net/blog/2017/thegamma-getting-started/
- alew1 8y agoAs I was reading, I kept thinking, he should really look at The Little Typer and Pie. Then that was Section V! (Really, many of the books in that series do this. The Reasoned Schemer for logic programming, The Little Prover for ACL2-style first-order logic.)