"The VM code is about 2K lines long, the multipass compiler code is about 3K lines and the shared code is about 2K lines long."<p>I was surprised by these numbers so I checked, and this is highly misleading (or very much out of date). The parser alone (<a href="https://github.com/marcobambini/gravity/blob/master/src/compiler/gravity_parser.c" rel="nofollow">https://github.com/marcobambini/gravity/blob/master/src/comp...</a>) is over 2K lines, and with the lexer and the AST definitions the <i>frontend</i> of the compiler is already comfortably above 3K lines. Also, the VM (<a href="https://github.com/marcobambini/gravity/blob/master/src/runtime/gravity_vm.c" rel="nofollow">https://github.com/marcobambini/gravity/blob/master/src/runt...</a>) is about 2K lines, but then there is another 3K lines in another "runtime" file (<a href="https://github.com/marcobambini/gravity/blob/master/src/runtime/gravity_core.c" rel="nofollow">https://github.com/marcobambini/gravity/blob/master/src/runt...</a>).<p>Still, it's not a huge project, and it might be interesting as a point of study for people interested in compilers (to bytecode) or bytecode interpreters. The input syntax looks pretty as well.<p>Interestingly, <a href="https://github.com/marcobambini/gravity/blob/master/src/runtime/gravity_vm.c" rel="nofollow">https://github.com/marcobambini/gravity/blob/master/src/runt...</a> also serves as a nice illustration of the fact that if tabs are allowed in source code, people will <i>mix</i> them with spaces, resulting in code that looks bad unless you have the exact same tab width preferences as the author.
For anyone who considers this interesting and/or looking for alternatives: apart from the well-known Lua there's also MicroPython [1] whos specs actually read a lot like the specs of Gravity but then some more (well, it's Python 3.5 minus a couple of features, also compiles with C99 compilers, is fairly small for being a Python, embeddable, more mature at this point, been tested on more platforms/architectures, ...).<p>[1] <a href="http://micropython.org/" rel="nofollow">http://micropython.org/</a> <a href="https://github.com/micropython/micropython/" rel="nofollow">https://github.com/micropython/micropython/</a>
Is it possible to embed Gravity in my C/C++ project and safely run <i>untrusted</i> Gravity code?<p>The Lua implementation supports the creation of sandboxes to run untrusted scripts, but this is a feature that other embeddable languages (e.g. Wren, Python) don't seem to support.<p>I feel like this would be a basic requirement - or is it common to embed a scripting language without limiting what scripts are able to do?
A while back I was interested in learning more about programming compilers, so I checked this project out. I actually added array map, filter, reduce, and sort methods to the language, which was fun and a learning process.
As a hobbyist I love seeing new languages. I look at their features and a few simple examples and immediately imagine they'll solve all the issues I have faced with other languages.<p>I generally appreciate the massive amount work that goes into something like this.<p>But when I want to work on a project, I am wary of using something new. I just know in my heart I'll set the wrong flag on the compiler and the binary will end up in a directory I can't find and it'll take me two days to figure out how to do it.<p>My question is this: if the main strength of this language is that uses Swift-like syntax, and lets you develop native apps in Android and iOS, why not just make an Android compiler for Swift?
As an embedded programmer, it is still very hard to displace C and will be for some time. The two main reasons: the compilers are well-behaved, and the debug tools are very, very mature. One thing newcomers overlook is the importance of understanding what the compiler does to the code. C++ is notorious for being painfully unpredictable, and in the embedded world, that is a death sentence. mbed is learning this the hard way. On the other side, debug tools are critical. Unlike the decade long surge of web-related programming with its sophisticated GUI-based debugging, embedded is a completely different beast, and requires much more attention to detail since reprogramming costs are so high. Because C has such a robust hardware debugging ecosystem, it is a clear winner.<p>It'll be a long time before anything knocks C down as #1 in the embedded space. Even as the definition of embedded stretches to include *nix variants (like Yocto), there will always be the squeeze to get rid of that and run bare metal with C.
I’m a little bummed about the class-based bit; I generally want structs/records, not classes. Specifically, I want to avoid inheritance altogether (yes I know I don’t have to use it, but I still have to interact with it when libraries or coworkers use it). Still, this is a neat little scripting language, and best of luck.
>null<p>>dynamic typing<p>>naked if-else bodies<p>I'm sorry, but I just don't see how this improves on anything. How will GravLang make me a better, more productive programmer? How will it make my programs more robust?<p>Don't get me wrong, as a hobby project it's fine, but as a "real" language it doesn't have any selling points to me.
>Gravity syntax is designed to be familiar to people coming from C-like languages like Javascript, Swift, C++, C# and many more. We started working on this new language a year before Apple announced Swift and we were happily surprised to discovered how similar both syntax appear.<p>Amusing how the language looks so much like Kotlin - a language released in 2011 and 3 years before Swift.
At first look I love how the language is designed.<p>Now I'm curious about the "embedded" part . Apple doesn't allow any VM or JIT to be embedded for iOS application.
Either I'm missing something or else this tech is not compliant with Apple Security Guidelines.
Such an underrated project. IMHO if this one was launched by Facebook or Google now things would be different like 15k+ plus stars on GitHub and tech news sites posting articles with titles like "a new game changer language" and stuff.
Does anyone have numbers on how light it is? How much memory Does it need? How big is the library? Does it compare favourably to Lua or Guile? Guile shouldn't be hard to beat for size, but that's generally not what they try to achieve.
"<i>It is a class-based concurrent scripting language with a modern Swift like syntax.</i>"<p>So, it looks like every other language designed in the last 40 years? This is good?
Not to rain on your parade here but, in what world is a interpreter "fast and efficient"? Embeddable, minimal footprint and zero external dependencies etc are all excellent real selling points here.