Has anybody used webassembly as a compiler target for pet languages? I’m struggling with the text format- it’s a very strange mix of standard linear-format assembly and block structure.
-
Show this thread
-
@wcrichton did this come up in your PL class? Curious to see what others think1 reply 0 retweets 0 likesShow this thread -
Replying to @alpha_convert
I had students write WASM directly, so different situation. My understanding is that as a compile target, you're expected to use language-specific bindings to WASM, similar to LLVM, e.g. https://github.com/WebAssembly/wasm-c-api/blob/master/include/wasm.h …
2 replies 0 retweets 1 like -
Replying to @wcrichton @alpha_convert
But I think the text format isn't too bad! It's weirdly forgiving, but I would just think about it as Lisp/S-expressions.
1 reply 0 retweets 0 likes -
Replying to @wcrichton
Hmm- the main problem is that it doesn't really work like s-exps because there's no sequencing operator- you simply write a \separated (c1 c2 c3 c4 ...) for a sequence of commands, interspersed with *structured* control blocks. I'd rather have it one way or the other, is all.
1 reply 0 retweets 1 like -
Replying to @alpha_convert
Perhaps you just need to write more imperative code ;-) or maybe it's helpful to see it as a direct encoding of the AST? See e.g. the OCaml datatype in the reference interpreter: https://github.com/WebAssembly/spec/blob/master/interpreter/syntax/ast.ml#L71 …
1 reply 0 retweets 0 likes -
Replying to @wcrichton
I'm writing the compiler in rust in an effort to write more imperative code ;-). And that is helpful. Thanks!
1 reply 0 retweets 1 like
!!! you should use my abstract binding tree generator! https://github.com/willcrichton/rabbot … bob would be proud. It has many strictures, although few affordances (hasn't worked in a few years), but I'm sure that's fixable.
-
-
Replying to @wcrichton
haven't thought about ABTs in a while. Good thought though. If I do end up using them- I'll probably roll my own implementation. If I don't, I won't really understand them.
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
cognitive psychology. PhD