mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 06:38:45 +01:00
120 lines
6.1 KiB
HTML
120 lines
6.1 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||
<title>Welcome – Wren</title>
|
||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic|Source+Code+Pro:400|Lato:400|Sanchez:400italic,400' rel='stylesheet' type='text/css'>
|
||
<!-- Tell mobile browsers we're optimized for them and they don't need to crop
|
||
the viewport. -->
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
|
||
</head>
|
||
<body id="top">
|
||
<header>
|
||
<div class="page">
|
||
<div class="main-column">
|
||
<h1><a href="./">wren</a></h1>
|
||
<h2>a classy little scripting language</h2>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
<div class="page">
|
||
<nav>
|
||
<ul>
|
||
<li><a href="getting-started.html">Getting Started</a></li>
|
||
</ul>
|
||
<section>
|
||
<h2>language</h2>
|
||
<ul>
|
||
<li><a href="syntax.html">Syntax</a></li>
|
||
<li><a href="expressions.html">Expressions</a></li>
|
||
<li><a href="variables.html">Variables</a></li>
|
||
<li><a href="control-flow.html">Control Flow</a></li>
|
||
<li><a href="error-handling.html">Error Handling</a></li>
|
||
<li><a href="modules.html">Modules</a></li>
|
||
</ul>
|
||
</section>
|
||
<section>
|
||
<h2>types</h2>
|
||
<ul>
|
||
<li><a href="values.html">Values</a></li>
|
||
<li><a href="classes.html">Classes</a></li>
|
||
<li><a href="fibers.html">Fibers</a></li>
|
||
<li><a href="functions.html">Functions</a></li>
|
||
<li><a href="lists.html">Lists</a></li>
|
||
<li><a href="maps.html">Maps</a></li>
|
||
</ul>
|
||
</section>
|
||
<section>
|
||
<h2>reference</h2>
|
||
<ul>
|
||
<li><a href="core">Core Library</a></li>
|
||
<li><a href="embedding-api.html">Embedding API</a></li>
|
||
<li><a href="performance.html">Performance</a></li>
|
||
<li><a href="contributing.html">Contributing</a></li>
|
||
<li><a href="qa.html">Q & A</a></li>
|
||
</ul>
|
||
</section>
|
||
</nav>
|
||
<main>
|
||
<h1>Welcome</h1>
|
||
<h2>Wren is a small, fast, class-based concurrent scripting language <a href="#wren-is-a-small,-fast,-class-based-concurrent-scripting-language" name="wren-is-a-small,-fast,-class-based-concurrent-scripting-language" class="header-anchor">#</a></h2>
|
||
<p>Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in
|
||
a familiar, modern <a href="syntax.html">syntax</a>.</p>
|
||
<div class="codehilite"><pre><span class="n">IO</span><span class="p">.</span><span class="n">print</span><span class="p">(</span><span class="s2">"Hello, world!"</span><span class="p">)</span>
|
||
|
||
<span class="kd">class</span> <span class="nc">Wren</span> <span class="p">{</span>
|
||
<span class="n">flyTo</span><span class="p">(</span><span class="n">city</span><span class="p">)</span> <span class="p">{</span>
|
||
<span class="n">IO</span><span class="p">.</span><span class="n">print</span><span class="p">(</span><span class="s2">"Flying to "</span><span class="p">,</span> <span class="n">city</span><span class="p">)</span>
|
||
<span class="p">}</span>
|
||
<span class="p">}</span>
|
||
|
||
<span class="kd">var</span> <span class="n">adjectives</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Fiber</span> <span class="p">{</span>
|
||
<span class="p">[</span><span class="s2">"small"</span><span class="p">,</span> <span class="s2">"clean"</span><span class="p">,</span> <span class="s2">"fast"</span><span class="p">].</span><span class="n">map</span> <span class="p">{</span><span class="o">|</span><span class="n">word</span><span class="o">|</span> <span class="n">Fiber</span><span class="p">.</span><span class="n">yield</span><span class="p">(</span><span class="n">word</span><span class="p">)</span> <span class="p">}</span>
|
||
<span class="p">}</span>
|
||
|
||
<span class="k">while</span> <span class="p">(</span><span class="o">!</span><span class="n">adjectives</span><span class="p">.</span><span class="n">isDone</span><span class="p">)</span> <span class="n">IO</span><span class="p">.</span><span class="n">print</span><span class="p">(</span><span class="n">adjectives</span><span class="p">.</span><span class="n">call</span><span class="p">())</span>
|
||
</pre></div>
|
||
|
||
|
||
<ul>
|
||
<li>
|
||
<p><strong>Wren is small.</strong> The codebase is about <a href="https://github.com/munificent/wren/tree/master/src">5,000 lines</a>. You can
|
||
skim the whole thing in an afternoon. It's <em>small</em>, but not <em>dense</em>. It
|
||
is readable and <a href="https://github.com/munificent/wren/blob/46c1ba92492e9257aba6418403161072d640cb29/src/wren_value.h#L378-L433">lovingly-commented</a>.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>Wren is fast.</strong> A fast single-pass compiler to tight bytecode, and a
|
||
compact object representation help Wren <a href="performance.html">compete with other dynamic
|
||
languages</a>.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>Wren is class-based.</strong> There are lots of scripting languages out there,
|
||
but many have unusual or non-existent object models. Wren places
|
||
<a href="classes.html">classes</a> front and center.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>Wren is concurrent.</strong> Lightweight <a href="fibers.html">fibers</a> are core to the execution
|
||
model and let you organize your program into an army of communicating
|
||
coroutines.</p>
|
||
</li>
|
||
<li>
|
||
<p><strong>Wren is a scripting language.</strong> Wren is intended for embedding in
|
||
applications. It has no dependencies, a small standard library,
|
||
and <a href="embedding-api.html">an easy-to-use C API</a>. It compiles cleanly as C99, C++98
|
||
or anything later.</p>
|
||
</li>
|
||
</ul>
|
||
<p>If you like the sound of this, <a href="getting-started.html">give it a try</a>! Even better, you can
|
||
<a href="contributing.html">contribute to Wren itself</a>.</p>
|
||
</main>
|
||
</div>
|
||
<footer>
|
||
<div class="page">
|
||
<div class="main-column">
|
||
<p>Wren lives <a href="https://github.com/munificent/wren">on GitHub</a> — Made with ❤ by <a href="http://journal.stuffwithstuff.com/">Bob Nystrom</a> and <a href="https://github.com/munificent/wren/blob/master/AUTHORS">friends</a>.</p>
|
||
<div class="main-column">
|
||
</div>
|
||
</footer>
|
||
</body>
|
||
</html> |