HNHacker News
TopNewBestAskShowJobs

glebbash

99 karma · joined May 26, 2024

submissionscomments
glebbash··on LO – simple WASM native language
It's funny yeah but it makes sense and is not really a problem.

You would write a compiler in the language that is the closest to your perfect. Trying to fix the original language by making a "clone" of it and adding/removing features to your liking.

That is what I want to change here by making a very simple language that if someone would like they could just fork it and add/remove the needed features instead of building one from scratch.

If this idea won't work then at least a very simple compiler would be a good learning resource, so a win win anyways.

glebbash··on LO – simple WASM native language
Well the goal for this project is to go dependency free so, yep, it's not a good fit here.
glebbash··on LO – simple WASM native language
Cool project you too :) It's fun to see how the language of the first compiler affects a lot of the syntax of the languages we build.
glebbash··on LO – simple WASM native language
Absolutely. The memory management is manual like in C, but with addition of defers it is actually quite good to work with.

Here is the source for the allocator: https://github.com/glebbash/LO/blob/81f96bb09e3a0b1455b32497...

It also links to where I learned how to build the "proper" allocator from scratch.

glebbash··on LO – simple WASM native language
Yay a first user :) Added the license.
glebbash··on LO – simple WASM native language
Fixed the link, forgot that markdown references use double square brackets.

Hmm, I haven't thought about it the license actually, I would default to MIT, but wanted to keep the number of files minimal in repo, hehe.

Will figure it out asap, thanks.

glebbash··on LO – simple WASM native language
Alright, will take a look at it sometime. But the more interesting proposal for me right now is the component model.
glebbash··on LO – simple WASM native language
Yes. Compiling single files is supported by calling the exported `compile` function, example setup here: https://github.com/glebbash/LO/blob/60b80d1b325136ce1ceaf4dc....

For includes to work compiler uses WASI which can be implemented in the browser. LO playground and VSCode extension use this approach. Playground link: https://glebbash.deno.dev/lo-playground/ and source: https://github.com/glebbash/glebbash.dev/blob/main/static/lo...

glebbash··on LO – simple WASM native language
I don't see a need for it. Maybe for some higher level scripting, but I don't have any plans for that.
glebbash··on LO – simple WASM native language
Mostly for recreational programming. And then for exploring what the languages with minimal infrastructure could look like.
glebbash··on LO – simple WASM native language
That was how it started actually, I wanted to make a superset of WAT. But then I switched to a more familiar C-like constructs and that gave me a big boost in productivity.

I think the superset of WAT idea is very viable and someone more comfortable with s-expressions should explore that for sure.

glebbash··on LO – simple WASM native language
Thanks, I will definitely do that once the feature set will get stable enough. Don't want to update docs constantly :)

As for now, you can check the examples folder and explore the compiler sources, tried to keep everything simple.

glebbash··on LO – simple WASM native language
Hi, it's my first time posting here, just wanted to share the language I was working on for some time now.

I've been working on integrating it with WASM-4 runtime this past week. And with minimal changes to the compiler I created this demo game: https://rawcdn.githack.com/glebbash/LO/da8305293f5438967619e...

Game source here: https://github.com/glebbash/LO/blob/main/examples/test/demos...