9 ms·
I want to make a few observations about this, and why I found it seemingly less "hacky" than other such attempts: - As I said in an earlier comment, "var" is j
by breckinloggins 13y ago
I want to make a few observations about this, and why I found it seemingly less "hacky" than other such attempts:
- As I said in an earlier comment, "var" is just a typedef'd "void *". The downside is that libCello code is essentially untyped, but the upsides are that the C preprocessor is now enough to do the processing needed for the rest of the macros in the language, and that you can still mix regular typed C with libCello code for a "best of both worlds" mix.
- Looks pretty, right? What you're responding to is not just the nice non-capitalized macros and the $ keyword, but the syntax highlighting in his examples. Fire up a text editor and write you some libCello code without this highlighting and it probably won't feel as nice.
I'm extremely interested in the idea of taking the syntax highlighting, formatting, and code completion OUT of these specialized IDEs and plugins and into some kind of standard "bidirectional channel" between a language processor or compiler, its macro system, and the user's editor of choice.
We should be able to make entire DSLs and specialized syntaxes that not only compile, but are able to provide rich information to the surrounding development environment in a standardized way. I'm not alone on this. F#'s Type Providers do exactly that. But imagine being able to control not only the "intellisense", but also the syntax highlighting, argument/return tooltips, documentation, preferred formatting, snippets, etc.
And by "surrounding development environment" I mean everything from the command line to vim and emacs all the way to Sublime Text, Eclipse, and Visual Studio. Even github! Why do you have to register a new syntax highlighter on github for a language and hope they turn it on?
- bodski 13y agoSteve Yegge at Google is/was involved in a project called 'Grok' which sounds pretty similar to that. I really hope it catches on also. http://bsumm.net/2012/08/11/steve-yegge-and-grok.html http://bsumm.net/2012/08/11/steve-yegge-and-grok.html http://www.youtube.com/watch?v=KTJs-0EInW8 http://www.youtube.com/watch?v=KTJs-0EInW8 HN discussion: https://news.ycombinator.com/item?id=4371267 https://news.ycombinator.com/item?id=4371267
- breckinloggins 13y agoThanks! I knew I had read something that was along these lines and that was it. I've been thinking about this problem for years. Perhaps it's time I worked on it myself.
- bodski 13y agoTurning up blanks here trying to find any kind of project site for it, looks to be internal for now. I've long wanted to see something like an Eclipse daemon offering tool support to external editors etc. Ensime [1] does something along these lines, getting Scala' compiler functionality into Emacs using the Swank protocol from Slime [2]. [1]https://github.com/aemoncannon/ensime https://github.com/aemoncannon/ensime [2]http://aemoncannon.github.io/ensime/#tth_sEcC http://aemoncannon.github.io/ensime/#tth_sEcC
- williamcotton 13y ago> I'm extremely interested in the idea of taking the syntax highlighting, formatting, and code completion OUT of these specialized IDEs and plugins and into some kind of standard "bidirectional channel" between a language processor or compiler, its macro system, and the user's editor of choice. Well maybe if we stopped using ASCII files as our source code and used a richer type of document we could start to make some improvements! What kind of rich document? Well, what about HTML? Did you know you can even embed interactive elements in such documents? What if we started embedding our source code and editors in our documents instead of the other way around? The whole model is inverted, but mainly for historical reasons, because you know, in 1979 all we had was VT100 to interface with our machines... it's like we never moved on... why is my "code" a splattering of ASCII files in a directory? A package definition, tests, dotfiles for this and for that... ship the editor, the tests, the docs, the examples, and the source ALL as one document!
- gertef 13y agoHTML is ASCII.
- williamcotton 13y agoSure, but compare "HTML + Web Browser + HTTP" to "ASCII + VT100"... Right now the terminal is our window and it is nothing but colored ASCII. You can create something interactive and "graphical" like vim or emacs inside of it, but then you can't ship that complete dev environment very easily... it has to be rebuilt from scratch by the individual programmer. The web makes it very easy to ship interactive, dynamic documents and environments around.
- jlgreco 13y agoYou're not the first to have this idea, nor will you be the last. Think about why it has not succeeded already.
- williamcotton 13y ago
- orangeduck 13y agoAuthor here. Yeah the syntax looks much better with correct highlighting. I've provided a custom definition for Notepad++ on the repo - and of course there is the definition used on the website too. I'm also a big fan of DSLs and would love see some of the things you mention. My next (fun) big project is actually not so far from the same lines ;) Many thanks to everyone for the kind comments! It really is encouraging. :)
- mtdewcmu 13y agoIf you would like to take on something that is genuinely lacking from C, try creating something equivalent to C++ templates for C. I'm not sure that it can be usefully accomplished using only the C preprocessor. The C preprocessor is extremely underpowered. So it might require its own preprocessor. I wouldn't make them exactly like C++ templates. I'd just focus on the useful things that you can't currently do in C, like write a qsort()-equivalent that doesn't suffer the performance penalty of callbacks. You can almost get there with macros, but not quite -- it would be ridiculously ugly at best.
- vilya 13y agoThis sounds like a similar idea to JetBrains' MPS: http://www.jetbrains.com/mps/ http://www.jetbrains.com/mps/ The idea with that was that you could provide a structured description of a mini-language and it would be sufficient to generate not only a parser, but also a syntax-highlighting IDE with smart code completion, debugging and other neat features. It looks like they're still developing it too, which is a nice surprise: back when I was still interested in it, it never seemed to have taken off.
- bodski 13y agoMPS sounds more like some kind of equivalent to Xtext, i.e. for ease of producing and and hosting DSLs. Tools like Xtext and MPS actually tie you in to their host environments (Eclipse and IntelliJ respectively). What I took GP to mean, and indeed what Yegge's Grok appears to aim for, is the need for a universal modelling framework 'standard' for languages, tools and runtimes. Some kind of equivalent to LLVM but in the 'other direction' for modelling language semantics instead of code. Once a tool (e.g. editor) implements that standard it is able to 'plug in' to any tooling that also implements the standard. Potentially eliminating huge amounts of duplicated effort for tool makers etc.
- kazagistar 13y agoI am not sure I understand. Is there enough similarity between the semantics of languages that a one-size-fits-all solution is even remotely possible? It seems more likely that it would be something that would not-quite work for every language, and result in worse tooling for the sake of standardization.
- conradev 13y agolibclang supports this and a lot more advanced functionality, but only works for languages supported by Clang: http://clang.llvm.org/doxygen/group__CINDEX.html http://clang.llvm.org/doxygen/group__CINDEX.html (It is what Xcode uses underneath, a C API that any IDE or dynamic language module could take advantage of)