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

question/comment about using ts-llvm and emscripten to replace webpack #11

Open
cowlicks opened this issue Jan 20, 2019 · 1 comment
Open

Comments

@cowlicks
Copy link

Hi, I started looking for a JS frontend for the llvm today because I found webpack to be very difficult to use, and I was hoping I could use some combo of ts-llvm and emscripten to "compile" my javascript (and typescript) for the browser. I think this project would be suitable, but it doesn't seem to be feature complete enough yet.

I'm not sure if you considered a use case like this, I'm not even sure it would be very practical. But I thought it might be worth mentioning.

There didn't seem to be a js to llvm compiler out there, will this project work to compile plain js to llvm?

happy hacking,

@emlai
Copy link
Owner

emlai commented May 9, 2019

Hi!

Compiling TS code via ts-llvm and emscripten for the browser would be entirely possible, once ts-llvm is mature enough. The only problem is I'm not sure if you could access the DOM or other web APIs.

For compiling plain JS to LLVM, the dynamically typed nature of JS would prevent many of the LLVM code generation and optimization possibilities that can be done in a strictly-typed TS subset. The resulting code would probably be slower than just running the JS directly in the browser or Node.js.

However if we want to be able to use JS libraries from ts-llvm-compiled code, then we would need to compile the JS to LLVM, or somehow generate a ts-llvm-compatible wrapper API for the library. I'm not sure if that's practical.

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