Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Embed Gravity programming language into your code (marcobambini.github.io)
35 points by marcobambini on Nov 9, 2020 | hide | past | favorite | 8 comments


Hi all, the author here.

I wanted to create a programming language with the following properties:

- Class-based

- A JS/Swift/Kotlin like syntax

- Bytecode generation

- A clear distinction between front-end and back-end so at runtime, we need only the VM related code to execute the bytecode

- Lightweight and easy embeddable

- Extensible/customizable via bridge API(s) exposed via delegation (no need to hack/modify the code)


I'm in a situation where I need to embed a scripting language in a Swift codebase and had decided for Wren very recently since some form of coroutines are a necessity for me. I understand Gravity also has Fibers.

Would you recommend me to investigate Gravity further?

It's a bit unclear what I would get from Gravity that I don't have in Wren. Maybe a slight different syntax?


I'm interested in what it offers compared to Wren. I'm really curious and hopefully the author will see this.


Every now and then Gravity shows up on hn and it always makes me smile--a couple years ago I added some built-in array methods as one of my first forays into compilers and I had a lot of fun with it. Probably my first "real" OSS contribution.


@author: Why, given there are tons of good scripting langs already here?

(to other who didn't know what data-driven programming meant https://en.wikipedia.org/wiki/Data-driven_programming "In computer programming, data-driven programming is a programming paradigm in which the program statements describe the data to be matched and the processing required [...] Standard examples of data-driven languages are the text-processing languages sed and AWK")


There's an overview page that does a pretty good job of explaining why. https://marcobambini.github.io/gravity/#/README


I read it, it says what it is and what it has but doesn't compare itself there to other langs.


Embeddable in C and able to work on iOS and Android would cut the list of comparisons down quite a bit.

TCL would be somewhat comparable, various embeddable JS interpreters, lua, etc.

"The compiler and virtual machine combined, add less than 200KB to the executable on a 64 bit system." would make lua perhaps the most obvious alternative. Perhaps they really wanted traditional class based OO.

One of the tutorials for Creo is a good example of what they wanted it for: https://docs.creolabs.com/tutorials/game_tutorial_part1.html




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: