retroforth/doc/html/chapters/general/starting.html

109 lines
4.8 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>.</title>
<style type="text/css">
* { color: #000; background: #fff; max-width: 700px; }
tt, pre { background: #dedede; color: #111; font-family: monospace;
white-space: pre; display: block; width: 100%; }
.indentedcode { margin-left: 2em; margin-right: 2em; }
.codeblock {
background: #dedede; color: #111; font-family: monospace;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
padding: 7px;
display: block;
}
.indentedlist { margin-left: 2em; color: #000; }
span { white-space: pre; }
.text { color: #000; white-space: pre; background: #dedede; }
.colon { color: #000; background: #dedede; }
.note { color: #000; background: #dedede; }
.str { color: #000; text-decoration: underline; background: #dedede; }
.num { color: #000; background: #dedede; font-weight: bold; font-style: italic; }
.fnum { color: #000; font-weight: bold; background: #dedede; }
.ptr { color: #000; font-weight: bold; background: #dedede; }
.fetch { color: #000; font-style: italic; background: #dedede; }
.store { color: #000; font-style: italic; background: #dedede; }
.char { color: #000; background: #dedede; }
.inst { color: #000; background: #dedede; }
.defer { color: #000; background: #dedede; }
.imm { color: #000; font-weight: bold; background: #dedede; }
.prim { color: #000; font-weight: bolder; background: #dedede; }
.tt { white-space: pre; font-family: monospace; background: #dedede; }
.h1, .h2, .h3, .h4 { white-space: normal; }
.h1 { font-size: 125%; }
.h2 { font-size: 120%; }
.h3 { font-size: 115%; }
.h4 { font-size: 110%; }
.hr { display: block; height: 2px; background: #000000; }
</style>
</head><body>
<p><br/><br/>
Retro can be run for scripting or interactive use.
<br/><br/>
<span class="h2">Interactive</span>
<br/><br/>
To start it interactively, run: <span class="tt">retro</span> without any command line
arguments, or with <span class="tt">-i</span>.
<br/><br/>
Starting the interactive system:
<br/><br/>
<span class='codeblock'><span class="tt">```</span><br/><span class="tt">retro </span><br/>
<span class="tt">```</span></span><br/><br/>
Or:
<br/><br/>
<span class='codeblock'><span class="tt">```</span><br/><span class="tt">retro -i </span><br/>
<span class="tt">```</span></span><br/><br/>
This should be sufficient for most uses.
<br/><br/>
<br/><br/>
Retro will work with piped input.
<br/><br/>
E.g.,
<br/><br/>
<span class='codeblock'><span class="tt">```</span><br/><span class="tt">echo "'lol s:put nl" <span class='defer'>|</span> retro </span><br/>
<span class="tt">```</span></span><br/><br/>
<br/><br/>
You can run code in a file very easily. This is simply:
<br/><br/>
<span class='codeblock'><span class="tt">```</span><br/><span class="tt">retro filename </span><br/>
<span class="tt">```</span></span><br/><br/>
You can follow the filename with any arguments that it may need.
These will be accessible to the program via the <span class="tt">script:arguments</span>
and <span class="tt">script:get-argument</span> words.
<br/><br/>
Source files must be written in Unu format.
<br/><br/>
<span class="h2">Scripting</span>
<br/><br/>
You can use Retro to write scripts. Add a shebang:
<br/><br/>
<span class='codeblock'><span class="tt">```</span><br/><span class="tt"><span class='num'>#!/usr/bin/env</span> retro </span><br/>
<span class="tt">```</span></span><br/><br/>
And make the file executable.
<br/><br/>
Source files must be written in Unu format.
<br/><br/>
<br/><br/>
For a summary of the full command line arguments available:
<br/><br/>
<tt class='indentedcode'>Scripting&nbsp;Usage:</tt>
<br/><br/>
<tt class='indentedcode'>&nbsp;&nbsp;&nbsp;&nbsp;retro&nbsp;filename&nbsp;[script&nbsp;arguments...]</tt>
<br/><br/>
<tt class='indentedcode'>Interactive&nbsp;Usage:</tt>
<br/><br/>
<tt class='indentedcode'>&nbsp;&nbsp;&nbsp;&nbsp;retro&nbsp;[-h]&nbsp;[-i]&nbsp;[-f&nbsp;filename]&nbsp;[-t]</tt>
<br/><br/>
<tt class='indentedcode'>&nbsp;&nbsp;-h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Display&nbsp;this&nbsp;help&nbsp;text</tt>
<tt class='indentedcode'>&nbsp;&nbsp;-i&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Interactive&nbsp;mode&nbsp;(line&nbsp;buffered)</tt>
<tt class='indentedcode'>&nbsp;&nbsp;-f&nbsp;filename&nbsp;&nbsp;Run&nbsp;the&nbsp;contents&nbsp;of&nbsp;the&nbsp;specified&nbsp;file</tt>
<tt class='indentedcode'>&nbsp;&nbsp;-t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Run&nbsp;tests&nbsp;(in&nbsp;```&nbsp;blocks)&nbsp;in&nbsp;any&nbsp;loaded&nbsp;files</tt>
</p>
</body></html>