GitXplorerGitXplorer
s

jsxx

public
176 stars
11 forks
4 issues

Commits

List of commits on branch main.
Verified
158786c790fc7b58bd5d947e469b6e77cc4c47ff

License update

ssurma committed 2 years ago
Verified
e6520e1ee3001023eb78a70bbecc132ce3f83a96

Add license

ssurma committed 2 years ago
Verified
1d434d0a2ebb933742637f876479359942e37c62

Add README

ssurma committed 2 years ago
Verified
07aab0136ae61898041c1c3e15a507616a5c1880

Rename flag

ssurma committed 2 years ago
Verified
ee1c7e1e1a693d4c70907aa36396bcff32aee44c

Change indentation to spaces in tests

ssurma committed 2 years ago
Verified
b72ce6f861628fa232a50a20195762600993e823

Support for wasm

ssurma committed 2 years ago

README

The README file for this repository.

jsxx

jsxx is a transpiler that compiles JavaScript to C++.

More details can be found in the blog post.

Usage

jsxx reads JavaScript from stdin and compiles it to C++ and then uses clang++ to create a binary.

$ cat testprog.js | cargo run
$ ./output
1.000000,2.000000,3.000000

If you have WASI-SDK installed, you can also compile straight to WebAssembly:

$ cat testprog.js | \
    cargo run -- \ 
    --wasm \
    --clang-path $HOME/Downloads/wasi-sdk-16.0/bin/clang++ \
    -- -Oz -flto -Wl,--lto-O3
$ wasmtime output.wasm
1.000000,2.000000,3.000000

If you want to inspect the generated C++ code, use --emit-cpp.


Apache 2.0