TSRX Playground

Real yuku-tsrx, compiled to WebAssembly, running in this tab: parse, analyze, generate.

Examples

Pick a committed parser fixture, or type your own TSRX. Everything below is produced in this tab.

playground.tsrx
export function Cart({ items }): unknown @{
  const total = items.length;

  <section className="cart">
    @if (total > 0) {
      @for (const item of items; index i; key item.id) {
        <span>{i}:{item.id}</span>
      } @empty {
        <span>empty</span>
      }
    } @else {
      <span>no cart</span>
    }
    <style>.cart { display: grid; }</style>
  </section>
}
a TSRX component, highlighted with the TSRX grammar tsx · module

The decoded program, as JSON. TSRX nodes keep their own names: JSXCodeBlock, TSRXExpression, JSXStyleElement.

the parser starts when this page loads