Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language virtual machines #535

Closed
tclin914 opened this issue Feb 3, 2016 · 4 comments
Closed

Language virtual machines #535

tclin914 opened this issue Feb 3, 2016 · 4 comments

Comments

@tclin914
Copy link

tclin914 commented Feb 3, 2016

Hi,

I don't really understand what mean "Virtual machines for languages such as bash, Python, Ruby should work." mentioned in design/tooling support.
Is it a virtual machine written in WebAssembly which can run in V8 to execute Python or Ruby program?

Thank you

@ppopth
Copy link
Contributor

ppopth commented Feb 3, 2016

Yes, I guess

@jfbastien
Copy link
Member

WebAssembly itself is a low-level VM, and it's designed to be able to host other VMs such as language VMs (bash, python, ruby).

So yes: a WebAssembly VM implemented on top of V8 will be able to host bash.wasm / python.wasm / ruby.wasm which implement these languages.

Closing for now, let me know if I can clarify further!

@tclin914
Copy link
Author

tclin914 commented Feb 3, 2016

Thanks for your reply.

I have the other question is that bash.wasm / python.wasm / ruby.wasm is it translated from C/C++ or directly written in WebAssembly by hand?

And, is it possible to write a big tool directly in WebAssembly by hand (difficult debugging?) ?

Thank you.

@jfbastien
Copy link
Member

You would compile bash / python / ruby from their C/C++ source using a regular compiler, but targeting WebAssembly. It's the same as compiling for ARM or MIPS: you may cross-compile to another architecture.

To a C/C++ compiler WebAssembly simply looks like a different ISA and OS. We're working on teaching LLVM about it, but any other compiler could support WebAssembly code generation.

You can write .wast files by hand, (e.g. see the spec repo's tests at https://github.com/WebAssembly/spec/tree/master/ml-proto/test) but you don't really want to: WebAssembly is mainly a compiler target, not a language you'd want to write. It's the same as writing x86 assembly: you sure can, there are cases where it makes sense, but most of the time you want higher-level languages and lean on the compiler to generate the assembly.

Hope this makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants