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

WebAssembly #57

Open
flip111 opened this issue Jan 17, 2024 · 3 comments
Open

WebAssembly #57

flip111 opened this issue Jan 17, 2024 · 3 comments

Comments

@flip111
Copy link

flip111 commented Jan 17, 2024

Does the compiler run on WebAssembly (wasm)? Is such feature planned?

@zesterer
Copy link
Owner

zesterer commented Jan 17, 2024

When you say 'run on', what do you mean?

Currently, the only compiler backend is a simple bytecode interpreter. This is largely because I've been putting far more focus into the front (syntax, type system) and middle (optimiser) ends so far. In time, I want to support cranelift and perhaps even LLVM as backends.

If you're talking about the compiler itself: yes! When you visit tao.jsbarretto.com and run code, you're actually running a copy of the compiler that's been compiled to WASM and is running in your browser locally.

@flip111
Copy link
Author

flip111 commented Jan 17, 2024

If you're talking about the compiler itself: yes!

Yes that was my question. Though it would be very interesting if webassembly can also be a backend. How does it execute right now in the playground?

by the way playground seems to be broken when i hit run

[03] Error: Lang item not is missing
[03] Error: Lang item neg is missing
[03] Error: Lang item add is missing
[03] Error: Lang item sub is missing
[03] Error: Lang item mul is missing
[03] Error: Lang item div is missing
[03] Error: Lang item eq is missing
[03] Error: Lang item ord_ext is missing
[03] Error: Lang item and_ is missing
[03] Error: Lang item or_ is missing
[03] Error: Lang item join is missing
[03] Error: Lang item go is missing
[03] Error: Lang item bool is missing

@zesterer
Copy link
Owner

You need to import at minimum the core library (and also main if you want to run anything), since it contains lang items required for the language (like operator typeclasses). You can do that by adding the following to the top of the file.

mod main = "../lib/main.tao"

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

2 participants