0.1.0 • Published 11 months ago
@mlc-ai/web-xgrammar v0.1.0
web-xgrammar
This folder contains the source code and emcc bindings for compiling XGrammar to Javascript/Typescript via emscripten.
Build from source
Install emscripten. It is an LLVM-based compiler that compiles C/C++ source code to WebAssembly.
- Follow the installation instruction to install the latest emsdk.
- Source
emsdk_env.shbysource /path/to/emsdk_env.sh, so thatemccis reachable from PATH and the commandemccworks. - We can verify the successful installation by trying out
emccin the terminal.
Modify the content of
cmake/config.cmaketo beweb/config.cmake.Run the following
source /path/to/emsdk_env.sh npm install npm run build
Example
To try out the test webpage, run the following
cd example
npm install
npm startTesting
For testing in node environment, run:
npm test0.1.0
11 months ago