6 ms·
I'm very fond of small, specific and simple languages without sacrificing inherent complexity. For me, that includes IP adresses, UUIDs, timestamps, URIs, print
by sharpercoder 8y ago
I'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 agoHere's one DSL product that empasizes editor support: https://www.jetbrains.com/mps/ https://www.jetbrains.com/mps/
- aasasd 8y agoBy the way, there are these things JetBrains MPS and Eclipse Xtext, which are metaprogramming environments, allowing you to define DSLs and actually get IDE support for features you add. Rather heavyweight compared to just grammar, or to Lisp macros, but apparently you get more in return, seeing as grammar and macros don't teach your editors about the semantics of the new entities.
- CMCDragonkai 8y agoAlso Haskell quasiquoter. See embedded java and embedded C.