WebAssembly / website

WebAssembly website
https://webassembly.org
Apache License 2.0
272 stars 180 forks source link

Compiling to WASM from a Bash script? #230

Open philiprhoades opened 3 years ago

philiprhoades commented 3 years ago

People,

I am interested in learning about WAT and WASM and eventually Rust but Ruby is more immediately familiar however it is not quite useful enough for compiling to WASM yet.

Has anyone thought about developing a compiler that could convert Bash scripts into WASM?

Thanks, Phil.

sbc100 commented 3 years ago

WebAssembly itself does not define any of the core primitives that are fundamental to shell scripting (e.g. fork / exec / pipe / IO streams) so it seem like a particularly bad fit for compilation to wasm.

Also, as far as I know nobody as every tried compiling bash scripts to anything, they are always interpreted by bash itself.

philiprhoades commented 3 years ago

so it seem like a particularly bad fit for compilation to wasm.

OK, thanks for that - so what do you think would be the best minimal compiler system to get started with?

sbc100 commented 3 years ago

so it seem like a particularly bad fit for compilation to wasm.

OK, thanks for that - so what do you think would be the best minimal compiler system to get started with?

Are you looking to work on a compiler that targets wasm? Or are you looking to experiment to and existing language that already targets wasm? If its the later then any llvm-based compiler such and clang or rustc is a good place to start. llvm's existing support for compiling to wasm is pretty mature at this point.

philiprhoades commented 3 years ago

Are you looking to work on a compiler that targets wasm?

Yes.

Or are you looking to experiment to and existing language that already targets wasm?

That is also of interest . .

If its the later then any llvm-based compiler such and clang or rustc is a good place to start. llvm's existing support for compiling to wasm is pretty mature at this point.

LIke I said in the OP, I am interested in learning about WAT - ideally, if I had the time, I would learn to code directly in WASM - well at least for some trivial stuff anyway - just as an exercise . .