very cool, i was also interested to compile to wasm but getting into it seeemed daunting. Will definitely use your project as inspiration
@contextfree Жыл бұрын
Definitely review output from other compilers for ideas. That helps me a lot.
@1vader Жыл бұрын
There are some wasm optimizers like binaryen which I'd assume would optimize stuff like variables that are stored and immediately loaded again and then never used again. So maybe you could just run that after your compilation to get some speedups. Although I guess it might add some annoying dependencies and performance probably isn't exactly a priority.
@contextfree Жыл бұрын
Yeah, I've used wasm-opt from binaryen, and I think that's my fallback. Worst case, people can follow up with that after a non optimizing compiler, if/when that matters to them. Maybe I should include it as part of my overall test script, though, so I can compare processing times and output sizes and contents.
@UliTroyo Жыл бұрын
I dig the syntax :)
@casperes0912 Жыл бұрын
What was the difference between print message and print(message)? (and possibly print (message))?
@contextfree Жыл бұрын
Nothing really. I mostly want to support `print message` so constructs like `if whatever be ...` don't need parens, and those constructs get parsed the same as any function call, even if processed differently in the compiler (effectively macros although I'm not sure yet if I plan to expose macro definition support to user code). But when nesting function calls, not needing parens at every level might also be prettier sometimes, so I'll have to think about recommended style some. And I'm also thinking more on the `print (message)` thing. I was considering allowing tuples earlier, although as I mentioned in the video, I'm leaning away from that now. If there were tuples, then `something (a, b)` would pass in a single tuple as the first argument, whereas `something(a, b)` would have two separate arguments. I didn't change that comment yet because I want to think about it a bit more. But if I really don't have tuples, the space might as well be irrelevant, unless I'm forgetting something. Sometimes I only notice details when I start implementing. Anyway, sorry for being so longwinded in my reply!
@contextfree Жыл бұрын
And yeah, I have some plans, but I'm also winging a lot.
@casperes0912 Жыл бұрын
@@contextfree right. Makes sense. I think each style, by association, will encourage different styles. Print message would make me write more functional as my brain would initially group the language with ML languages like OCaml. Print(message) puts me in a procedural mindset. At least initially.
@contextfree Жыл бұрын
I'm definitely aiming for functional-first attitudes in Rio, but not aiming for purity.
@irubberduck Жыл бұрын
Really interesting series. A completely different perspective compared to languages trying to be mature or production-ready. Especially the wild file / program. Is wasm limited to a 32-bit address space? Otherwise, why do your strings get unwrapped into 32-bit address and length parameters?
@AtomicalYT Жыл бұрын
WebAssembly in its core spec uses 32-bit integers for pointers. There is a separate proposal to have 64-bit memory addresses
@0marble8 Жыл бұрын
As im writing one of those parser generator programs for my thesis, ive been wondering, do real language designers actually use them? It seems like a lot of projects i looked at, all write their parser by hand
@contextfree Жыл бұрын
I've tried antlr and others in the past, and I think they're good for some things, but yeah, sometimes easier to be flexible with hand rolled. Or maybe I'm just stubborn, even if other people have good reasons to roll their own.
@familyshare3724 Жыл бұрын
I imagine a statically typed language with only two primitive cardinals: non-null value and non-null list. The "nullable" value can only be a list with zero elements.
@contextfree Жыл бұрын
Any variety in the non-null value or do you imagine using Peano numbers or some such?
@familyshare3724 Жыл бұрын
@@contextfree oh yes, full typing, definable class types. Just no null. Anything "nullable" is just the empty set of that type. Consider a deserialized JSON with no null. Empty string same as [] (if not predefined). Arrays and objects are simply different types of a collection.
@familyshare3724 Жыл бұрын
@@contextfree i would hope it would be simpler and faster than Lua, with types, and of course 0 indexed.
@contextfree Жыл бұрын
Thanks for the further explanation! I guess now would be a bad time to say that I often flirt with 1-based indexing ...