News for hackers. Stuff that matters.

glebbash

Re:LO – simple WASM native language on Monday May 27, 2024 @10:40AM (#40491166)
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.

Re:LO – simple WASM native language on Monday May 27, 2024 @06:24AM (#40489411)
Well the goal for this project is to go dependency free so, yep, it's not a good fit here.
Re:LO – simple WASM native language on Monday May 27, 2024 @02:38AM (#40488254)
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.
Re:LO – simple WASM native language on Monday May 27, 2024 @02:30AM (#40488194)
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.

Re:LO – simple WASM native language on Monday May 27, 2024 @02:18AM (#40488122)
Yay a first user :) Added the license.
Re:LO – simple WASM native language on Monday May 27, 2024 @02:06AM (#40488049)
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.

Re:LO – simple WASM native language on Sunday May 26, 2024 @04:14PM (#40485020)
Alright, will take a look at it sometime. But the more interesting proposal for me right now is the component model.
Re:LO – simple WASM native language on Sunday May 26, 2024 @03:58PM (#40484870)
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...

Re:LO – simple WASM native language on Sunday May 26, 2024 @03:13PM (#40484595)
I don't see a need for it. Maybe for some higher level scripting, but I don't have any plans for that.
Re:LO – simple WASM native language on Sunday May 26, 2024 @02:58PM (#40484502)
Mostly for recreational programming. And then for exploring what the languages with minimal infrastructure could look like.
Re:LO – simple WASM native language on Sunday May 26, 2024 @02:23PM (#40484244)
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.

Re:LO – simple WASM native language on Sunday May 26, 2024 @02:13PM (#40484180)
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.

Re:LO – simple WASM native language on Sunday May 26, 2024 @12:28PM (#40483368)
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...