raz / site / content / home.html

92 lines · 5.0 KiB · raw · history · last change de634aad

1<section class="hero">
2 <h1>raz</h1>
3 <p class="tag">A small systems language in Wirth&rsquo;s tradition, for x86-64 Linux.
4 <em>Raz</em> is Polish for <em>one</em>, as in counting.</p>
5 <div class="cta">
6 <a class="btn primary" href="tour/index.html">Take the tour: Raz, Set, Go</a>
7 <a class="btn" href="advanced/index.html">More Raz</a>
8 <a class="btn" href="#download">Download</a>
9 <a class="btn" href="spec.html">Read the report</a>
10 <a class="btn" href="source/index.html">Browse the source</a>
11 </div>
12</section>
13
14<p>A raz program can lay a record over a device&rsquo;s registers, read and
15write memory exactly as written, take part in lock-free algorithms, make
16system calls and call C libraries. It has no garbage collector and no hidden
17run time: what the program does is what its text says.</p>
18
19<p>The compiler is written in raz, about 10,700 lines, and builds itself. It makes
20x86-64 machine code and the ELF file itself, with no assembler or linker, in
21one pass, at about 500,000 lines a second.</p>
22
23<div class="facts">
24 <span><b>~10,700</b> lines of compiler</span>
25 <span><b>~500K</b> lines compiled a second</span>
26 <span><b>1</b> report, <b>@PAGES@</b> pages</span>
27 <span><b>static</b> executables, no run time to install</span>
28</div>
29
30<div class="cols">
31 <div>
32 <h2>A taste</h2>
33 <div class="file"><span>Taste.raz</span></div>
34<pre class="code"><code>@SNIPPET@</code></pre>
35<pre class="output"><code>@OUTPUT@</code></pre>
36 </div>
37 <div>
38 <h2>What it has</h2>
39 <ul class="features">
40 <li>Integers of 8 to 64 bits, signed and unsigned, which wrap; <code>BOOL</code>, <code>F32</code>, <code>F64</code>. Nothing converts unless it is written.</li>
41 <li>Arrays, checked slices, pointers, records laid out as C lays them out, packed records, enumerations, sets, and variants with <code>match</code>.</li>
42 <li>Every index and slice is checked; a failure says where it was, with the values, and the calls under way.</li>
43 <li>Strings of UTF-8 bytes, raw strings over lines that keep the code's indent, and <code>match</code> on a string.</li>
44 <li>Every variable starts at zero. Behaviour is defined everywhere but through pointers.</li>
45 <li>No garbage collector: memory comes from an allocator the program chooses and passes.</li>
46 <li>Several results, <code>ERROR</code> values and <code>defer</code>, in place of exceptions.</li>
47 <li>Modules with bodies, and generic modules: <code>Map(K, V; hash, eq)</code>.</li>
48 <li><code>^VOLATILE T</code> and the atomics <code>CAS</code>, <code>XCHG</code>, <code>XADD</code>, <code>FENCE</code>, for devices and lock-free code.</li>
49 <li><code>extern</code> procedures and variables from C, code procedures in assembly, and <code>SYSCALL</code>.</li>
50 <li>Threads without C, a library of <code>Out</code>, <code>Str</code>, <code>Bytes</code>, <code>Fmt</code>, <code>Map</code>, <code>Sort</code> and more, and gdb that knows your lines.</li>
51 <li>A formatter, a documentation tool, and editor support for vim and emacs.</li>
52 </ul>
53 </div>
54</div>
55
56<h2>Learn it</h2>
57<p><a href="tour/index.html"><strong>Raz, Set, Go</strong></a> is a tour of the
58language in 15 lessons, each with programs you can run. <a
59href="advanced/index.html"><strong>More Raz</strong></a> is the second tour:
60the library, programs with no run time, procedures in assembly, system calls,
61volatile accesses, atomics and lock-free code, in 18 more.</p>
62
63<h2>The language, in writing</h2>
64<p>The language is defined by <a href="spec.html">the report</a>, which is
65short on purpose: whatever it doesn&rsquo;t allow, raz doesn&rsquo;t have.
66Its second volume describes the library. Both are on one page, and each is
67a PDF: <a href="raz.pdf">the language</a> (@PAGES@ pages) and
68<a href="raz-lib.pdf">the library</a>.</p>
69
70<h2 id="download">Download</h2>
71<p>raz @VERSION@ is a tarball for x86-64 Linux with the compiler, <code>raz</code>,
72its library, <code>lib/</code>, which it finds beside itself, the formatter
73and the documentation tool as sources in <code>tools/</code>, and the manual
74pages. It needs nothing else installed.</p>
75<div class="cta">
76 <a class="btn primary" href="download/@TARBALL@">Download raz @VERSION@</a>
77 <a class="btn" href="download/@TARBALL@.sha256">SHA-256</a>
78</div>
79<pre class="code"><code>$ tar xzf @TARBALL@
80$ ln -s $PWD/@DIR@/raz ~/.local/bin/raz
81$ raz run Hello.raz</code></pre>
82<p>The link works since raz finds <code>lib/</code> beside its real path. The
83manual pages are in <code>man/</code>: <code>man ./man/raz-tutorial.7</code>.
84The address <code>download/latest</code> always leads to the newest release,
85and <code>download/raz-@VERSION@-linux-x86_64.tar.gz</code> to this one, for
86good. Earlier releases: @EARLIER@; each has its SHA-256 beside it, with
87<code>.sha256</code> added to its name.</p>
88<p class="sha">SHA-256 <code>@SHA256@</code></p>
89<p><a href="source/releases/index.html">Release pages</a> give each
90version's commit, notes, compiler and source archives, with checksums.
91Browse the <a href="source/index.html">source and history</a>, or clone:
92<code>git clone https://raz.lucela.org/source/</code>.</p>