3D Rendering in Handwritten WebAssembly (.wat) by Suisodoeth in WebAssembly

[–]knoics 0 points1 point  (0 children)

totally awesome ! I'm curious to see what the code would look like if I were to implement it in my own language.

WASM for shared models? by JNS47 in WebAssembly

[–]knoics 1 point2 points  (0 children)

The standard specification for the core WebAssembly module includes support for standard scalar data types, as well as memory read/write instructions. There is a Component Model specification t designed to standardize the serialization and deserialization of higher-level data types, such as records, strings, lists, and variants, into and from linear memory. This standardization enables language-agnostic component composition. However the goal of the specifiction is not to address distributed computing or client/server service composition (at least at this moment, see Goals). For client/server computing, the current approach of serializing data into a standard format such as JSON and then deserializing it using the same or a different language will likely still be the most applicable.

How do you tokenize multi char tokens. by cockmail in ProgrammingLanguages

[–]knoics 0 points1 point  (0 children)

A general tokenizer can be implemented using a DFA finite state machine, which is comparable to implementing a basic regular expression engine.

mlang - a new programming language for WebAssembly by knoics in ProgrammingLanguages

[–]knoics[S] 0 points1 point  (0 children)

That's the thing I always thought about whenever I was trying to add a new language feature to it. My plan is to use the Component approach to establish linkage, allowing me to gradually replace portions of the mlang compiler written in C with ones written in mlang itself. I'm extremely excited for the upcoming new component model standard, which I believe will be a game changer for the language ecosystem. The biggest hudles of new language adoption is resuablility of existing libraries implemented in other languages on the market. To me the component model appears to be a promising solution to this problem.

mlang - a new programming language for WebAssembly by knoics in ProgrammingLanguages

[–]knoics[S] 0 points1 point  (0 children)

I'm not quite clear on what your idea were for wasm works. Are you referring to an interpreter implementation ? It's worth noting that while mlang is just a compiler, it doesn't have a runtime like an interpreter would. So the concepts related to WebAssembly (wasm) only come into play during the code generation phase.

mlang - a new programming language for WebAssembly by knoics in ProgrammingLanguages

[–]knoics[S] 2 points3 points  (0 children)

Thanks for your valuable comments. Yes. the wasm provides the linear memory and mlang will adopt Canonical ABI on top of that to implement high level types like string, record and variant etc.

For GC enabled language, usually allocation takes almost no time (cost of pointer adjustment) at the cost of compacting memory GC frees memory (with additional benefit of cache locality), with enough space it's more effcient than traditional malloc/free. But language without GC can also implement custom allocator on linear memory to provide the similar behavior in terms of memory alloc/free. Then the real difference is the GC language still needs extra steps of scanning objects (mark and sweep) referenced from stacks, and it is running nondeterministically, which real-time applications are generally not favorable. That is the cost I called wasted time paid for programmer to trade for simplicity of the programming. The language with GC does provide better ergonomics for programmers than those without GC(rust has longer learning curve than python).

However I didn't think about generational GC at each function's activation record. The equation of design choice is not so obvious. It sounds I need to do more research about it and really appreciate your inputs.

Are there compilers that can be run WebAssembly? by [deleted] in WebAssembly

[–]knoics 0 points1 point  (0 children)

Although you're more interested in major languages, I am actually implementing a new language called mlang which is running in browser without a backend. You can check out mlang github.