xgrammar

Fast, Flexible and Portable Structured Generation

Latest version: 0.2.5

Add to xmake.lua

add_requires("xgrammar 0.2.5")

Learn how to add and link packages with Xmake →

Information

License
Apache-2.0
Recipe updated
2026-08-02T05:19:06.000Z

Platforms

  • wasm: wasm32, wasm64
  • msys: i386, x86_64
  • mingw: i386, x86_64, arm, arm64
  • windows: x86, x64, arm, arm64, arm64ec
  • linux: i386, x86_64, armv7, armv7s, arm64, mips, mips64, mipsel, mips64el, loong64, riscv64, s390x, ppc, ppc64, ppc64el, sparc64
  • harmony: armeabi-v7a, arm64-v8a, x86, x86_64
  • cross: i386, x86_64, arm, armv7, arm64, mips, mips64, mips64el, riscv, riscv64, loong64, s390x, ppc, ppc64, ppc64el, sh4, sparc64
  • android: armeabi, armeabi-v7a, arm64-v8a, riscv64, x86, x86_64, mips, mip64
  • iphoneos: arm64, x86_64
  • macosx: x86_64, arm64

Options

python_bindings
Build Python bindings · Type: boolean · Default: false

Versions

  • v0.1.19
  • v0.1.21
  • v0.1.22
  • v0.1.23
  • v0.1.24
  • v0.1.25
  • v0.1.26
  • v0.1.27
  • v0.1.29
  • v0.1.31
  • v0.1.32
  • v0.1.33
  • v0.2.1
  • v0.2.5

Dependencies

Install with xrepo

Install the package independently of a project and inspect its available configuration.

install

xrepo install "xgrammar 0.2.5"

show info

xrepo info "xgrammar"

Link a library to your target

Declare the requirement, then attach the library to the target that uses it.

xmake.lua

add_requires("xgrammar 0.2.5")

target("demo")
    set_kind("binary")
    add_files("src/*.cpp")
    add_packages("xgrammar")

Open a package environment

Open a shell with the environment exported by this package. Use the executable names documented by the package.

enter shell

xrepo env -b "xgrammar 0.2.5" shell