Files
wren/manual_src/pages/playground.html
T
retoor 04e467e09b feat: add wasm build targets, profile hooks, os_demo example, and restructure manual source
- Add `wasm`, `wasm-clean`, and `install-emscripten` phony targets to Makefile for WebAssembly cross-compilation
- Insert `WREN_PROFILE_ENTER`/`WREN_PROFILE_EXIT` macros in `wren_vm.h` and `wren_vm.c` to support optional runtime profiling via `WREN_PROFILE_ENABLED`
- Create `example/os_demo.wren` demonstrating Platform, Process, and conditional exit usage
- Update `example/regex_demo.wren` to import `Match` and exercise Match object properties, groups, and `matchAll`
- Remove static HTML manual pages (`base64.html`, `dns.html`, `json.html`) and replace with structured `manual_src/` directory containing Jinja2 templates, YAML metadata, and content pages
- Expand `README.md` with build targets table, manual building instructions, source layout, and guide for adding new module documentation
2026-01-26 04:12:14 +00:00

86 lines
4.3 KiB
HTML

{# retoor <retoor@molodetz.nl> #}
{% extends 'page.html' %}
{% set page_title = "Try Wren" %}
{% set breadcrumb = [{"title": "Playground"}] %}
{% set prev_page = {"url": "getting-started/repl.html", "title": "Using the REPL"} %}
{% set next_page = {"url": "language/index.html", "title": "Syntax Overview"} %}
{% block extra_head %}
<link rel="stylesheet" href="{{ static_prefix }}css/playground.css">
<script src="{{ static_prefix }}wasm/wren.js"></script>
{% endblock %}
{% block article %}
<h1>Try Wren</h1>
<p>Write and run Wren code directly in your browser. This playground uses WebAssembly to run a subset of Wren-CLI modules.</p>
<div class="playground-container">
<div class="playground-toolbar">
<button id="run-button" class="primary" disabled>Run</button>
<button id="clear-button">Clear Output</button>
<select id="example-select">
<option value="">Load Example...</option>
<option value="hello">Hello World</option>
<option value="fibonacci">Fibonacci</option>
<option value="classes">Classes</option>
<option value="math">Math Module</option>
<option value="json">JSON</option>
<option value="datetime">DateTime</option>
<option value="base64">Base64</option>
<option value="strutil">String Utils</option>
<option value="faker">Faker Data</option>
<option value="lists">Lists and Iteration</option>
</select>
<span id="wasm-status" class="wasm-status loading">Loading...</span>
</div>
<div class="playground-editor-wrapper">
<textarea id="wren-editor" spellcheck="false" placeholder="Enter Wren code here...">System.print("Hello, World!")</textarea>
</div>
<div class="output-panel">
<div class="output-header">Output</div>
<pre id="wren-output"></pre>
</div>
<div class="playground-help">
<kbd>Ctrl</kbd> + <kbd>Enter</kbd> to run &bull; <kbd>Tab</kbd> inserts spaces
</div>
</div>
<h2>Available Modules</h2>
<p>The following modules are available in this browser-based playground:</p>
<div class="modules-list">
<span class="module-badge">math</span>
<span class="module-badge">json</span>
<span class="module-badge">base64</span>
<span class="module-badge">bytes</span>
<span class="module-badge">datetime</span>
<span class="module-badge">strutil</span>
<span class="module-badge">html</span>
<span class="module-badge">markdown</span>
<span class="module-badge">argparse</span>
<span class="module-badge">wdantic</span>
<span class="module-badge">uuid</span>
<span class="module-badge">faker</span>
</div>
<div class="admonition note">
<div class="admonition-title">Note</div>
<p>Some modules require system access and are not available in the browser, including: <code>io</code>, <code>net</code>, <code>http</code>, <code>tls</code>, <code>sqlite</code>, <code>subprocess</code>, <code>os</code>, and <code>scheduler</code>.</p>
</div>
<h2>Learn More</h2>
<p>This playground is a quick way to experiment. For full functionality, install Wren-CLI locally:</p>
<ul>
<li><a href="getting-started/installation.html">Installation Guide</a></li>
<li><a href="language/index.html">Language Reference</a></li>
<li><a href="api/index.html">API Reference</a></li>
</ul>
<script src="{{ static_prefix }}js/playground.js"></script>
{% endblock %}