this post was submitted on 13 Nov 2023
1 points (100.0% liked)

Lisp

53 readers
3 users here now

founded 1 year ago
MODERATORS
 

When you implement your own programming language, one of the problems is to implement a GUI to play with it. If you compile with WASM, you can solve this issue and a as a bonus you will be able to demonstrate your language across the Internet quite easily.

However, there are some real issues. One is that Web Assembly handle strings as arrays of integers.

If you are interested, I compiled my own language: LispE as a WASM library.

I have written a few blogs about how to do it: https://github.com/naver/lispe/wiki/6.18-Handling-strings-in-WASM-without-burning-yourself

Here is also a guide on how to use this library: https://github.com/naver/lispe/wiki/6.17-A-WebAssembly-version-of-LispE

you are viewing a single comment's thread
view the rest of the comments
[–] CodeFarmer@alien.top 1 points 1 year ago (1 children)

Sorry, my news was slightly tongue in cheek. Any assembly-like solution ultimately treats strings that way.

[–] ralfD-@alien.top 1 points 1 year ago (1 children)

Well, probably more like sequences of bytes.

[–] Frere_de_la_Quote@alien.top 1 points 1 year ago

Not exactly. Javascript strings are encoded as UTF-16 characters. Each element in this array of integers is a UTF-16 code point... So basically most characters are encoded on int16_t, except for very large codes, such as emojis, which are usually implemented on two int16_t.