Watch the demo videos here: <a href="https://www.youtube.com/watch?v=uCfFTZSG-PQ&list=PL9pDl_Oth4crgIcBiX-mdMS9vtzIt-eDT" rel="nofollow">https://www.youtube.com/watch?v=uCfFTZSG-PQ&list=PL9pDl_Oth4...
The code is on GitHub, for example for the first video that renders a 3D cube with CSS the code is at <a href="https://github.com/geastack/examples/tree/main/apps/css-3d-cube" rel="nofollow">https://github.com/geastack/examples/tree/main/apps/css-3d-c.... It takes only a couple of CLI commands to get it running. For reference, I'm using a WaveShare ESP32-S3 AMOLED Touch 2.06" device here, but the same code renders on every target Gea compiles for.
with a lot of ai projects it's often that the only thing that does work is the demo. and im not saying this to be rude, its an ambitious project and im afk so i cant test it myself.
how does it compile js to c++? js is so dynamic it makes me think it either compiles to some kind of bytecode or its a heavily restricted subset of the language.
It took us 6 months to build the compiler. We analyze literally the hell out of the call graph. We started with strictly typed TS, which is trivial to compile. Then we added a dynamic fallback for projects that have "unknown"s and "any"s, then we had several architectural changes which allowed us to inspect those "claim"s. If you think about it, marking a variable "any" is a lazy claim. If it's ever used in one place and in one shape (akin to duck typing), you can create a static struct out of it...
So there's no byte code, and while not every single dynamic language feature has a corresponding static compilation, the base is pretty broad. So much so that Hono, the web framework, with all its dependencies, compile just fine.
It's ref counting, so most objects are freed as soon as the last reference goes away. Cycles are handled by a backup cycle collector using trial deletion (Bacon–Rajan style). Any object whose refcount drops without hitting zero becomes a candidate, and the collector traces from those candidates. In practice cycles are rare, and refcounting does almost all the work.
There were a lot of hurdles along the way and we solve them as we come across them. Keeping values native when JS uses them dynamically was a challenge. d = new Date(); d.foo = 1 is easy if you box everything, but then it's a slow interpreter (like some other projects in the field). So we had to invent a new mechanism; native types get a side table for extra properties.
Generics and union types were also challenging: one JS generic can need several different C++ layouts.
eval is limited: new Function runs on a small evaluator written in C++, and direct eval isn't supported yet.
slopinthebag · · focus · HN ↗
dashersw · · focus · HN ↗
The code is on GitHub, for example for the first video that renders a 3D cube with CSS the code is at <a href="https://github.com/geastack/examples/tree/main/apps/css-3d-cube" rel="nofollow">https://github.com/geastack/examples/tree/main/apps/css-3d-c.... It takes only a couple of CLI commands to get it running. For reference, I'm using a WaveShare ESP32-S3 AMOLED Touch 2.06" device here, but the same code renders on every target Gea compiles for.
slopinthebag · · focus · HN ↗
how does it compile js to c++? js is so dynamic it makes me think it either compiles to some kind of bytecode or its a heavily restricted subset of the language.
dashersw · · focus · HN ↗
So there's no byte code, and while not every single dynamic language feature has a corresponding static compilation, the base is pretty broad. So much so that Hono, the web framework, with all its dependencies, compile just fine.
wannabe44 · · focus · HN ↗
It does appear most JS features can be translated to C++, even if at some overhead. Did you encounter any which wasn't straightforward?
dashersw · · focus · HN ↗
There were a lot of hurdles along the way and we solve them as we come across them. Keeping values native when JS uses them dynamically was a challenge. d = new Date(); d.foo = 1 is easy if you box everything, but then it's a slow interpreter (like some other projects in the field). So we had to invent a new mechanism; native types get a side table for extra properties.
Generics and union types were also challenging: one JS generic can need several different C++ layouts.
eval is limited: new Function runs on a small evaluator written in C++, and direct eval isn't supported yet.
wannabe44 · · focus · HN ↗