Better HN
topnewbestaskshowjobs
Log inSign up

glebbash

99 karma · joined May 26, 2024 (2y ago) · 17 submissions

Submissions

1.

Show HN: LO, a WASM language - hack the compiler or make a game in a web IDE(lo.glebbash.dev ↗)

1 points · by glebbash · 6d ago · discuss

2.

Mshc – Minimal Self-Hosted Compiler(github.com ↗)

2 points · by glebbash · 1y ago · discuss

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

Well the goal for this project is to go dependency free so, yep, it's not a good fit here.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

Yay a first user :) Added the license.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

Alright, will take a look at it sometime. But the more interesting proposal for me right now is the component model.

comment 2y ago · link · parent

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...

comment 2y ago · link · parent

I don't see a need for it. Maybe for some higher level scripting, but I don't have any plans for that.

comment 2y ago · link · parent

Mostly for recreational programming. And then for exploring what the languages with minimal infrastructure could look like.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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.

comment 2y ago · link · parent

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...

16.

LO – simple WASM native language(github.com ↗)

221 points · by glebbash · 2y ago · 63 comments