Initial commit

This commit is contained in:
g1n 2022-08-31 15:00:20 +03:00
commit f796866bf1
Signed by: g1n
GPG Key ID: 8D352193D65D4E2C
7 changed files with 1668 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*~

5
README.org Normal file
View File

@ -0,0 +1,5 @@
#+TITLE: GRU DeerTree specifications
DeerTree is high-level programming language, focused on simplification of low-level development.
To convert this specifications to html, you need to use emacs

753
index.html Normal file
View File

@ -0,0 +1,753 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GRU DeerTree specifications</title>
<meta name="generator" content="Org Mode" />
<style>
#content { max-width: 60em; margin: auto; }
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #e6e6e6;
border-radius: 3px;
background-color: #f2f2f2;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
}
pre.src:before {
display: none;
position: absolute;
top: -8px;
right: 12px;
padding: 3px;
color: #555;
background-color: #f2f2f299;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-authinfo::before { content: 'Authinfo'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
</style>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content" class="content">
<h1 class="title">GRU DeerTree specifications</h1>
<p>
<a href="https://gruos.org/deertree/stdlib.html">GRU DeerTree standard library specifications</a>
</p>
<p>
DeerTree is high-level programming language, focused on simplification of low-level development.
</p>
<div id="outline-container-org3dd932f" class="outline-2">
<h2 id="org3dd932f">Lexical items</h2>
<div class="outline-text-2" id="text-org3dd932f">
</div>
<div id="outline-container-org49c0d4c" class="outline-3">
<h3 id="org49c0d4c">Comments</h3>
<div class="outline-text-3" id="text-org49c0d4c">
<ul class="org-ul">
<li>One line comment starts with <code>//</code> and ends with a newline.</li>
<li>Multiple lines comment starts with <code>/*</code> and ends with <code>*/</code>.</li>
</ul>
</div>
</div>
<div id="outline-container-org97232f2" class="outline-3">
<h3 id="org97232f2">Tokens</h3>
<div class="outline-text-3" id="text-org97232f2">
<ul class="org-ul">
<li>Token is minimal language unit in DeerTree.</li>
<li>There several types of tokens in DeerTree: /identifiers/, /keywords/ and /punctuation/.</li>
</ul>
</div>
<div id="outline-container-org2478505" class="outline-4">
<h4 id="org2478505">Identifiers</h4>
<div class="outline-text-4" id="text-org2478505">
<ul class="org-ul">
<li>Identifiers are program elements.</li>
<li>Keywords can't be used as identifiers.</li>
</ul>
</div>
</div>
<div id="outline-container-org92fe272" class="outline-4">
<h4 id="org92fe272">Keywords</h4>
<div class="outline-text-4" id="text-org92fe272">
<ul class="org-ul">
<li>Keywords are predefined and reserved words.</li>
<li>They are associated with specific features.</li>
</ul>
</div>
<ul class="org-ul">
<li><a id="org4bb54b9"></a>DeerTree keywords:<br />
<div class="outline-text-5" id="text-org4bb54b9">
<pre class="example">
fn, import, int, double, long, float, char, byte,
string, bool, true, false, return, if, else, const,
switch, case, for, do, while, break, continue, struct,
enum, union, type, goto, unsigned, extern, strict
(auto), (until), (define) -- this is not needed
</pre>
</div>
</li>
</ul>
</div>
<div id="outline-container-org4ad9656" class="outline-4">
<h4 id="org4ad9656">Punctuation</h4>
<div class="outline-text-4" id="text-org4ad9656">
<ul class="org-ul">
<li>Punctutation is character sequence that represents operators and punctuation.</li>
</ul>
</div>
<ul class="org-ul">
<li><a id="org2c99707"></a>DeerTree punctuation:<br />
<div class="outline-text-5" id="text-org2c99707">
<pre class="example">
'+', '-', '*', '/', '%', '++', '--'
'&amp;', '&amp;&amp;', '|', '||', '^', '&lt;&lt;', '&gt;&gt;',
'+=', '-=', '*=', '/=', '%=', '&amp;=', '|=', '^=',
'&gt;', '&gt;=', '&lt;', '&lt;=', '=', '==', '!', '~'
'(', ')', '{', '}', '[', ']', ',', '.', ';', ':'
</pre>
</div>
</li>
</ul>
</div>
<div id="outline-container-org8cdf339" class="outline-4">
<h4 id="org8cdf339">Integer literals</h4>
<div class="outline-text-4" id="text-org8cdf339">
<ul class="org-ul">
<li>An integer literal is sequence of digits that represents integer contstant.</li>
<li>Prefix before integer literal sets non-decimal base of it: <code>0b</code> or <code>0B</code> - binary, <code>0o</code> or <code>0O</code> - octal, <code>0x</code> or <code>0X</code> - hexadecimal.</li>
<li>Underscores don't change literal value, if they are after base prefix. Underscores can't be before integer literal or after.</li>
</ul>
</div>
<ul class="org-ul">
<li><a id="orgbe10644"></a>Integer literals examples:<br />
<div class="outline-text-5" id="text-orgbe10644">
<pre class="example">
123
12_34
0b0101010
0B0101010
0o20
0O20
0xff
0xFF
0Xff
0XFF
0xFF_FF_FF
_12 // invalid: handled as identifier
12_ // invalid: can't be in the end of integer literal, must separate digits
12__34 // invalid: there can't be two underscores in a row
0_xff // invalid: underscore can't be in base prefix
</pre>
</div>
</li>
</ul>
</div>
<div id="outline-container-org0ef3eca" class="outline-4">
<h4 id="org0ef3eca">Float literals</h4>
<div class="outline-text-4" id="text-org0ef3eca">
<ul class="org-ul">
<li>A floating-point literal is a decimal or hexadecimal representation of a floating-point constant.</li>
<li>A decimal floating-point literal consists of an integer part (decimal digits), a decimal point, a fractional part (decimal digits), and an exponent part (e or E followed by an optional sign and decimal digits).</li>
<li>A hexadecimal floating-point literal consists of a 0x or 0X prefix, an integer part (hexadecimal digits), a radix point, a fractional part (hexadecimal digits), and an exponent part (p or P followed by an optional sign and decimal digits).</li>
<li>Underscores don't change literal value, if they are after base prefix. Underscores can't be before float literal or after.</li>
</ul>
</div>
<ul class="org-ul">
<li><a id="orge7fb76f"></a>Integer literals examples:<br />
<div class="outline-text-5" id="text-orge7fb76f">
<pre class="example">
0.
12.34
1.23456
1.e+10
3_4.
</pre>
</div>
</li>
</ul>
</div>
<div id="outline-container-org67fd75f" class="outline-4">
<h4 id="org67fd75f">Rune literals</h4>
<div class="outline-text-4" id="text-org67fd75f">
<ul class="org-ul">
<li>A rune literal represents a rune constant, an integer value identifying a Unicode code point.</li>
<li>A rune literal is expressed as one or more characters enclosed in single quotes, as in 'x' or '\n'.</li>
<li>Within the quotes, any character may appear except newline and unescaped single quote.</li>
<li>Single quoted character represents the Unicode value of the character itself, while multi-character sequences beginning with a backslash encode values in various formats.</li>
</ul>
</div>
<ul class="org-ul">
<li><a id="orgcbb41c5"></a>After backslash, certain single-character escapes represent special values<br />
<div class="outline-text-5" id="text-orgcbb41c5">
<pre class="example">
\a U+0007 alert or bell
\b U+0008 backspace
\f U+000C form feed
\n U+000A line feed or newline
\r U+000D carriage return
\t U+0009 horizontal tab
\v U+000B vertical tab
\\ U+005C backslash
\' U+0027 single quote (valid escape only within rune literals)
\" U+0022 double quote (valid escape only within string literals)
</pre>
</div>
</li>
<li><a id="orge02b86b"></a>Rune literals examples<br />
<div class="outline-text-5" id="text-orge02b86b">
<pre class="example">
'a'
'\n'
'\000'
'\xFFF'
'aa' // invalid: too many characters
</pre>
</div>
</li>
</ul>
</div>
<div id="outline-container-org62e6c96" class="outline-4">
<h4 id="org62e6c96">String literals</h4>
<div class="outline-text-4" id="text-org62e6c96">
<ul class="org-ul">
<li>A string literal represents a string constant.</li>
<li>A string is sequence of characters.</li>
<li>The text between the quotes forms the value of the literal, with backslash escapes interpreted as rune literals.</li>
</ul>
</div>
<ul class="org-ul">
<li><a id="orgd23fba9"></a>String literals examples<br />
<div class="outline-text-5" id="text-orgd23fba9">
<pre class="example">
"a"
"aaa"
"\n"
"\""
"Hello, World\n"
</pre>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-orgd8c9712" class="outline-2">
<h2 id="orgd8c9712"><span class="todo TODO">TODO</span> Constants</h2>
</div>
<div id="outline-container-orgd2bcdb0" class="outline-2">
<h2 id="orgd2bcdb0">Variables</h2>
<div class="outline-text-2" id="text-orgd2bcdb0">
<ul class="org-ul">
<li>A variable is a location for storing a value.</li>
<li>Variables have /types/.</li>
<li>Each element of array acts as a variable.</li>
</ul>
</div>
<div id="outline-container-org68e49fd" class="outline-3">
<h3 id="org68e49fd">Variables examples</h3>
<div class="outline-text-3" id="text-org68e49fd">
<pre class="example">
int a;
float b;
char[] c;
int a = 12;
a = 34;
b = 56;
a = b;
</pre>
</div>
</div>
</div>
<div id="outline-container-org2f0b729" class="outline-2">
<h2 id="org2f0b729"><span class="todo TODO">TODO</span> Types</h2>
<div class="outline-text-2" id="text-org2f0b729">
<ul class="org-ul">
<li>A type can be defined using <code>type</code> command.</li>
</ul>
</div>
<div id="outline-container-orgecf3c87" class="outline-3">
<h3 id="orgecf3c87">Boolean types</h3>
<div class="outline-text-3" id="text-orgecf3c87">
<ul class="org-ul">
<li>A boolean type represents the set of Boolean truth values denoted by the predeclared constants <code>true</code> and <code>false</code>.</li>
<li><code>bool</code> is predeclared boolean type.</li>
</ul>
</div>
</div>
<div id="outline-container-org009286c" class="outline-3">
<h3 id="org009286c">Numeric types</h3>
<div class="outline-text-3" id="text-org009286c">
<ul class="org-ul">
<li>A numeric type represents a set of integer or floating-point values.</li>
</ul>
</div>
<div id="outline-container-orgade58f7" class="outline-4">
<h4 id="orgade58f7">Predeclared numeric types</h4>
<div class="outline-text-4" id="text-orgade58f7">
<pre class="example">
// TODO: unsigned and others
int - 32-bit integer
double - 64-bit integer
long - 64-bit integer
float - 32-bit floating-point numbers
char - 8-bit integer
byte - alias for char
</pre>
</div>
</div>
</div>
<div id="outline-container-org767bee3" class="outline-3">
<h3 id="org767bee3">String types</h3>
<div class="outline-text-3" id="text-org767bee3">
<ul class="org-ul">
<li>A string type represents the set of string values</li>
<li>A string value is a (possibly empty) sequence of character</li>
<li><code>string</code> is predeclared string type</li>
</ul>
</div>
</div>
<div id="outline-container-org04ffa8c" class="outline-3">
<h3 id="org04ffa8c">Array types</h3>
</div>
<div id="outline-container-orgcee5341" class="outline-3">
<h3 id="orgcee5341">Function types</h3>
</div>
<div id="outline-container-org4c402d3" class="outline-3">
<h3 id="org4c402d3">Dictionary types</h3>
</div>
</div>
<div id="outline-container-org60569fa" class="outline-2">
<h2 id="org60569fa"><span class="todo TODO">TODO</span> Declarations</h2>
<div class="outline-text-2" id="text-org60569fa">
</div>
<div id="outline-container-org531ea10" class="outline-3">
<h3 id="org531ea10">Label scopes</h3>
</div>
<div id="outline-container-orgfec1a31" class="outline-3">
<h3 id="orgfec1a31">Constant declarations</h3>
</div>
<div id="outline-container-orga93160c" class="outline-3">
<h3 id="orga93160c">Type declarations</h3>
</div>
<div id="outline-container-org4213441" class="outline-3">
<h3 id="org4213441">Variable declarations</h3>
<div class="outline-text-3" id="text-org4213441">
<pre class="example">
[type] [var-name];
[type] [var-name] = [value];
</pre>
</div>
</div>
<div id="outline-container-org3d98f15" class="outline-3">
<h3 id="org3d98f15">Function declarations</h3>
<div class="outline-text-3" id="text-org3d98f15">
<ul class="org-ul">
<li>A function declaration binds an identifier to function as /function name/</li>
</ul>
<pre class="example">
fn [function-name] '(' { arguments_list } ')' { '(' { type } ')' } '{' body '}'
</pre>
</div>
<div id="outline-container-orgfc87723" class="outline-4">
<h4 id="orgfc87723">Example</h4>
<div class="outline-text-4" id="text-orgfc87723">
<pre class="example">
fn inc_number(int num) (int) {
return num+1;
}
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgfb540a5" class="outline-2">
<h2 id="orgfb540a5"><span class="todo TODO">TODO</span> Expressions</h2>
</div>
<div id="outline-container-org860b116" class="outline-2">
<h2 id="org860b116"><span class="todo TODO">TODO</span> Statements</h2>
<div class="outline-text-2" id="text-org860b116">
</div>
<div id="outline-container-org4f9fb6f" class="outline-3">
<h3 id="org4f9fb6f">Empty statements</h3>
</div>
<div id="outline-container-org8ed90af" class="outline-3">
<h3 id="org8ed90af">Labeled statements</h3>
<div class="outline-text-3" id="text-org8ed90af">
<pre class="example">
[identifier] ':' body
</pre>
</div>
</div>
<div id="outline-container-org578ca81" class="outline-3">
<h3 id="org578ca81">Expression statements</h3>
<div class="outline-text-3" id="text-org578ca81">
<pre class="example">
expression
</pre>
</div>
</div>
<div id="outline-container-org2da9c45" class="outline-3">
<h3 id="org2da9c45">Increment/Decrement statements</h3>
<div class="outline-text-3" id="text-org2da9c45">
<pre class="example">
expression ( "++" | "--" )
</pre>
</div>
</div>
<div id="outline-container-orgdbb298c" class="outline-3">
<h3 id="orgdbb298c">Assignments</h3>
<div class="outline-text-3" id="text-orgdbb298c">
<pre class="example">
[identifier] ( '+=' | '-=' | '*=' | '/=' | '%=' | '|=' | '^=' | '&amp;=' | '=' ) expression
</pre>
</div>
</div>
<div id="outline-container-org5d5cf7b" class="outline-3">
<h3 id="org5d5cf7b">If statements</h3>
<div class="outline-text-3" id="text-org5d5cf7b">
<pre class="example">
"if" '(' condition ')' '{' body '}' ( ( "else if" | "else" ) )
</pre>
</div>
</div>
<div id="outline-container-org1057a3a" class="outline-3">
<h3 id="org1057a3a">switch statements</h3>
<div class="outline-text-3" id="text-org1057a3a">
<pre class="example">
"switch" '(' expression ')' '{' ( "case" expression | "else" ) body '}'
</pre>
</div>
</div>
<div id="outline-container-org02085fb" class="outline-3">
<h3 id="org02085fb">for statements</h3>
<div class="outline-text-3" id="text-org02085fb">
<pre class="example">
"for" '(' condition ')' '{' body '}'
</pre>
</div>
</div>
<div id="outline-container-org244aba7" class="outline-3">
<h3 id="org244aba7">while statements</h3>
<div class="outline-text-3" id="text-org244aba7">
<pre class="example">
"while" '(' condition ')' '{' body '}'
</pre>
</div>
</div>
<div id="outline-container-org991be9a" class="outline-3">
<h3 id="org991be9a">return statements</h3>
<div class="outline-text-3" id="text-org991be9a">
<ul class="org-ul">
<li>"return" statement terminates execution of function and provided result values.</li>
</ul>
<pre class="example">
return { expression }
</pre>
</div>
</div>
<div id="outline-container-org7fa9f86" class="outline-3">
<h3 id="org7fa9f86">break statements</h3>
<div class="outline-text-3" id="text-org7fa9f86">
<pre class="example">
"break"
</pre>
</div>
</div>
<div id="outline-container-orgea043ee" class="outline-3">
<h3 id="orgea043ee">continue statements</h3>
<div class="outline-text-3" id="text-orgea043ee">
<pre class="example">
"continue"
</pre>
</div>
</div>
<div id="outline-container-orgbd68d67" class="outline-3">
<h3 id="orgbd68d67">goto statements</h3>
<div class="outline-text-3" id="text-orgbd68d67">
<ul class="org-ul">
<li>"goto" statement transfers control to statement with corresponding label</li>
</ul>
<pre class="example">
goto [label]
</pre>
</div>
</div>
</div>
<div id="outline-container-org0a1219c" class="outline-2">
<h2 id="org0a1219c"><span class="todo TODO">TODO</span> Built-in functions</h2>
<div class="outline-text-2" id="text-org0a1219c">
</div>
<div id="outline-container-org7d22253" class="outline-3">
<h3 id="org7d22253"><code>sizeof()</code></h3>
</div>
<div id="outline-container-org49c914c" class="outline-3">
<h3 id="org49c914c"><code>len()</code></h3>
</div>
<div id="outline-container-org08cccd4" class="outline-3">
<h3 id="org08cccd4"><code>compare()</code></h3>
</div>
<div id="outline-container-orge066ab8" class="outline-3">
<h3 id="orge066ab8">Printing functions</h3>
<div class="outline-text-3" id="text-orge066ab8">
</div>
<div id="outline-container-org5e9e3f5" class="outline-4">
<h4 id="org5e9e3f5"><code>print();</code></h4>
</div>
<div id="outline-container-org99c8ba9" class="outline-4">
<h4 id="org99c8ba9"><code>println();</code></h4>
</div>
<div id="outline-container-org9b393ef" class="outline-4">
<h4 id="org9b393ef"><code>fprint();</code></h4>
</div>
<div id="outline-container-orgdd23359" class="outline-4">
<h4 id="orgdd23359"><code>fprintln()</code></h4>
</div>
<div id="outline-container-orgfe8bd91" class="outline-4">
<h4 id="orgfe8bd91"><code>sprint();</code></h4>
</div>
<div id="outline-container-org52a773a" class="outline-4">
<h4 id="org52a773a"><code>sprintln()</code></h4>
</div>
<div id="outline-container-org0e65bec" class="outline-4">
<h4 id="org0e65bec"><code>eprint();</code></h4>
</div>
<div id="outline-container-org536902e" class="outline-4">
<h4 id="org536902e"><code>eprintln()</code></h4>
</div>
</div>
<div id="outline-container-org8fc67a3" class="outline-3">
<h3 id="org8fc67a3">Converting functions</h3>
<div class="outline-text-3" id="text-org8fc67a3">
</div>
<div id="outline-container-org9ab87da" class="outline-4">
<h4 id="org9ab87da"><code>int()</code></h4>
</div>
<div id="outline-container-org11800e6" class="outline-4">
<h4 id="org11800e6"><code>float()</code></h4>
</div>
<div id="outline-container-orge0a7185" class="outline-4">
<h4 id="orge0a7185"><code>char()</code></h4>
</div>
<div id="outline-container-org8047085" class="outline-4">
<h4 id="org8047085"><code>str()</code></h4>
</div>
</div>
</div>
<div id="outline-container-orgb49e7cf" class="outline-2">
<h2 id="orgb49e7cf"><span class="todo TODO">TODO</span> Headers</h2>
</div>
</div>
</body>
</html>

267
specs.org Normal file
View File

@ -0,0 +1,267 @@
#+OPTIONS: toc:nil num:nil <:nil \n:nil ::nil timestamp:nil *:nil ':nil
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css"/>
#+EXPORT_FILE_NAME: index.html
#+TITLE: GRU DeerTree specifications
[[https://gruos.org/deertree/stdlib.html][GRU DeerTree standard library specifications]]
DeerTree is high-level programming language, focused on simplification of low-level development.
* Lexical items
** Comments
- One line comment starts with ~//~ and ends with a newline.
- Multiple lines comment starts with ~/*~ and ends with ~*/~.
** Tokens
- Token is minimal language unit in DeerTree.
- There several types of tokens in DeerTree: /identifiers/, /keywords/ and /punctuation/.
*** Identifiers
- Identifiers are program elements.
- Keywords can't be used as identifiers.
*** Keywords
- Keywords are predefined and reserved words.
- They are associated with specific features.
**** DeerTree keywords:
#+BEGIN_SRC
fn, import, int, double, long, float, char, byte,
string, bool, true, false, return, if, else, const,
switch, case, for, do, while, break, continue, struct,
enum, union, type, goto, unsigned, extern, strict
(auto), (until), (define) -- this is not needed
#+END_SRC
*** Punctuation
- Punctutation is character sequence that represents operators and punctuation.
**** DeerTree punctuation:
#+BEGIN_SRC
'+', '-', '*', '/', '%', '++', '--'
'&', '&&', '|', '||', '^', '<<', '>>',
'+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=',
'>', '>=', '<', '<=', '=', '==', '!', '~'
'(', ')', '{', '}', '[', ']', ',', '.', ';', ':'
#+END_SRC
*** Integer literals
- An integer literal is sequence of digits that represents integer contstant.
- Prefix before integer literal sets non-decimal base of it: ~0b~ or ~0B~ - binary, ~0o~ or ~0O~ - octal, ~0x~ or ~0X~ - hexadecimal.
- Underscores don't change literal value, if they are after base prefix. Underscores can't be before integer literal or after.
**** Integer literals examples:
#+BEGIN_SRC
123
12_34
0b0101010
0B0101010
0o20
0O20
0xff
0xFF
0Xff
0XFF
0xFF_FF_FF
_12 // invalid: handled as identifier
12_ // invalid: can't be in the end of integer literal, must separate digits
12__34 // invalid: there can't be two underscores in a row
0_xff // invalid: underscore can't be in base prefix
#+END_SRC
*** Float literals
- A floating-point literal is a decimal or hexadecimal representation of a floating-point constant.
- A decimal floating-point literal consists of an integer part (decimal digits), a decimal point, a fractional part (decimal digits), and an exponent part (e or E followed by an optional sign and decimal digits).
- A hexadecimal floating-point literal consists of a 0x or 0X prefix, an integer part (hexadecimal digits), a radix point, a fractional part (hexadecimal digits), and an exponent part (p or P followed by an optional sign and decimal digits).
- Underscores don't change literal value, if they are after base prefix. Underscores can't be before float literal or after.
**** Integer literals examples:
#+BEGIN_SRC
0.
12.34
1.23456
1.e+10
3_4.
#+END_SRC
*** Rune literals
- A rune literal represents a rune constant, an integer value identifying a Unicode code point.
- A rune literal is expressed as one or more characters enclosed in single quotes, as in 'x' or '\n'.
- Within the quotes, any character may appear except newline and unescaped single quote.
- Single quoted character represents the Unicode value of the character itself, while multi-character sequences beginning with a backslash encode values in various formats.
**** After backslash, certain single-character escapes represent special values
#+BEGIN_SRC
\a U+0007 alert or bell
\b U+0008 backspace
\f U+000C form feed
\n U+000A line feed or newline
\r U+000D carriage return
\t U+0009 horizontal tab
\v U+000B vertical tab
\\ U+005C backslash
\' U+0027 single quote (valid escape only within rune literals)
\" U+0022 double quote (valid escape only within string literals)
#+END_SRC
**** Rune literals examples
#+BEGIN_SRC
'a'
'\n'
'\000'
'\xFFF'
'aa' // invalid: too many characters
#+END_SRC
*** String literals
- A string literal represents a string constant.
- A string is sequence of characters.
- The text between the quotes forms the value of the literal, with backslash escapes interpreted as rune literals.
**** String literals examples
#+BEGIN_SRC
"a"
"aaa"
"\n"
"\""
"Hello, World\n"
#+END_SRC
* TODO Constants
* Variables
- A variable is a location for storing a value.
- Variables have /types/.
- Each element of array acts as a variable.
** Variables examples
#+BEGIN_SRC
int a;
float b;
char[] c;
int a = 12;
a = 34;
b = 56;
a = b;
#+END_SRC
* TODO Types
- A type can be defined using ~type~ command.
** Boolean types
- A boolean type represents the set of Boolean truth values denoted by the predeclared constants ~true~ and ~false~.
- ~bool~ is predeclared boolean type.
** Numeric types
- A numeric type represents a set of integer or floating-point values.
*** Predeclared numeric types
#+BEGIN_SRC
// TODO: unsigned and others
int - 32-bit integer
double - 64-bit integer
long - 64-bit integer
float - 32-bit floating-point numbers
char - 8-bit integer
byte - alias for char
#+END_SRC
** String types
- A string type represents the set of string values
- A string value is a (possibly empty) sequence of character
- ~string~ is predeclared string type
** Array types
** Function types
** Dictionary types
* TODO Declarations
** Label scopes
** Constant declarations
** Type declarations
** Variable declarations
#+BEGIN_SRC
[type] [var-name];
[type] [var-name] = [value];
#+END_SRC
** Function declarations
- A function declaration binds an identifier to function as /function name/
#+BEGIN_SRC
fn [function-name] '(' { arguments_list } ')' { '(' { type } ')' } '{' body '}'
#+END_SRC
*** Example
#+BEGIN_SRC
fn inc_number(int num) (int) {
return num+1;
}
#+END_SRC
* TODO Expressions
* TODO Statements
** Empty statements
** Labeled statements
#+BEGIN_SRC
[identifier] ':' body
#+END_SRC
** Expression statements
#+BEGIN_SRC
expression
#+END_SRC
** Increment/Decrement statements
#+BEGIN_SRC
expression ( "++" | "--" )
#+END_SRC
** Assignments
#+BEGIN_SRC
[identifier] ( '+=' | '-=' | '*=' | '/=' | '%=' | '|=' | '^=' | '&=' | '=' ) expression
#+END_SRC
** If statements
#+BEGIN_SRC
"if" '(' condition ')' '{' body '}' ( ( "else if" | "else" ) )
#+END_SRC
** switch statements
#+BEGIN_SRC
"switch" '(' expression ')' '{' ( "case" expression | "else" ) body '}'
#+END_SRC
** for statements
#+BEGIN_SRC
"for" '(' condition ')' '{' body '}'
#+END_SRC
** while statements
#+BEGIN_SRC
"while" '(' condition ')' '{' body '}'
#+END_SRC
** return statements
- "return" statement terminates execution of function and provided result values.
#+BEGIN_SRC
return { expression }
#+END_SRC
** break statements
#+BEGIN_SRC
"break"
#+END_SRC
** continue statements
#+BEGIN_SRC
"continue"
#+END_SRC
** goto statements
- "goto" statement transfers control to statement with corresponding label
#+BEGIN_SRC
goto [label]
#+END_SRC
* TODO Built-in functions
** ~sizeof()~
** ~len()~
** ~compare()~
** Printing functions
*** ~print();~
*** ~println();~
*** ~fprint();~
*** ~fprintln()~
*** ~sprint();~
*** ~sprintln()~
*** ~eprint();~
*** ~eprintln()~
** Converting functions
*** ~int()~
*** ~float()~
*** ~char()~
*** ~str()~
* TODO Headers

504
stdlib.html Normal file
View File

@ -0,0 +1,504 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GRU DeerTree standard library specifications</title>
<meta name="generator" content="Org Mode" />
<style>
#content { max-width: 60em; margin: auto; }
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #e6e6e6;
border-radius: 3px;
background-color: #f2f2f2;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
}
pre.src:before {
display: none;
position: absolute;
top: -8px;
right: 12px;
padding: 3px;
color: #555;
background-color: #f2f2f299;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-authinfo::before { content: 'Authinfo'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
</style>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div id="content" class="content">
<h1 class="title">GRU DeerTree standard library specifications</h1>
<div id="outline-container-org5c056f8" class="outline-2">
<h2 id="org5c056f8"><span class="todo TODO">TODO</span> Introduction</h2>
<div class="outline-text-2" id="text-org5c056f8">
<p>
{} - optional argument to function (FIXME: should be defined in main specfications)
</p>
</div>
</div>
<div id="outline-container-orgc6ec358" class="outline-2">
<h2 id="orgc6ec358"><span class="todo TODO">TODO</span> Buitlin syntax</h2>
</div>
<div id="outline-container-org1e52d2f" class="outline-2">
<h2 id="org1e52d2f"><span class="todo TODO">TODO</span> <code>&lt;def&gt;</code> header</h2>
<div class="outline-text-2" id="text-org1e52d2f">
<p>
FIXME: Like stddef.h in C, maybe more
</p>
</div>
<div id="outline-container-orge0a0b9a" class="outline-3">
<h3 id="orge0a0b9a">Types</h3>
<div class="outline-text-3" id="text-orge0a0b9a">
</div>
<div id="outline-container-orge184137" class="outline-4">
<h4 id="orge184137"><code>Size</code> - alias for unsigned long long</h4>
</div>
</div>
</div>
<div id="outline-container-org436400e" class="outline-2">
<h2 id="org436400e"><span class="todo TODO">TODO</span> <code>&lt;io&gt;</code> header</h2>
<div class="outline-text-2" id="text-org436400e">
</div>
<div id="outline-container-org9e8843f" class="outline-3">
<h3 id="org9e8843f">Types</h3>
<div class="outline-text-3" id="text-org9e8843f">
</div>
<div id="outline-container-org770cae1" class="outline-4">
<h4 id="org770cae1"><code>File</code> - an object type used for streams.</h4>
</div>
</div>
<div id="outline-container-orga2b675e" class="outline-3">
<h3 id="orga2b675e">Functions</h3>
<div class="outline-text-3" id="text-orga2b675e">
</div>
<div id="outline-container-org6007746" class="outline-4">
<h4 id="org6007746"><code>printf();</code> // C-like formatting</h4>
</div>
<div id="outline-container-org59399dd" class="outline-4">
<h4 id="org59399dd"><code>fprintf();</code></h4>
</div>
<div id="outline-container-org7d49c35" class="outline-4">
<h4 id="org7d49c35"><code>sprintf();</code></h4>
</div>
<div id="outline-container-org4aa202e" class="outline-4">
<h4 id="org4aa202e"><code>eprintf();</code></h4>
</div>
</div>
</div>
<div id="outline-container-org8d00b5d" class="outline-2">
<h2 id="org8d00b5d"><span class="todo TODO">TODO</span> <code>&lt;string&gt;</code> header</h2>
<div class="outline-text-2" id="text-org8d00b5d">
</div>
<div id="outline-container-org8f10c47" class="outline-3">
<h3 id="org8f10c47">Types</h3>
</div>
<div id="outline-container-org39f6f1b" class="outline-3">
<h3 id="org39f6f1b">Functions</h3>
<div class="outline-text-3" id="text-org39f6f1b">
</div>
<div id="outline-container-org7fe22ad" class="outline-4">
<h4 id="org7fe22ad"><code>isalnum()</code></h4>
</div>
<div id="outline-container-orgd567090" class="outline-4">
<h4 id="orgd567090"><code>isalpha()</code></h4>
</div>
<div id="outline-container-org125c5d0" class="outline-4">
<h4 id="org125c5d0"><code>isascii()</code></h4>
</div>
<div id="outline-container-org1665a58" class="outline-4">
<h4 id="org1665a58"><code>isblank()</code></h4>
</div>
<div id="outline-container-org1fc3621" class="outline-4">
<h4 id="org1fc3621"><code>iscntrl()</code> // FIXME: maybe not needed</h4>
</div>
<div id="outline-container-orgfd8a749" class="outline-4">
<h4 id="orgfd8a749"><code>isdigit()</code></h4>
</div>
<div id="outline-container-org4a55375" class="outline-4">
<h4 id="org4a55375"><code>isgraph()</code> // FIXME: maybe not needed</h4>
</div>
<div id="outline-container-org3a63abe" class="outline-4">
<h4 id="org3a63abe"><code>islower()</code></h4>
</div>
<div id="outline-container-org0150eb8" class="outline-4">
<h4 id="org0150eb8"><code>isprint()</code> // FIXME: maybe not needed</h4>
</div>
<div id="outline-container-orgf9ecf37" class="outline-4">
<h4 id="orgf9ecf37"><code>ispunct()</code></h4>
</div>
<div id="outline-container-orge8e9663" class="outline-4">
<h4 id="orge8e9663"><code>isspace()</code></h4>
</div>
<div id="outline-container-orgbb2880b" class="outline-4">
<h4 id="orgbb2880b"><code>isupper()</code></h4>
</div>
<div id="outline-container-orgcff8308" class="outline-4">
<h4 id="orgcff8308"><code>isxdigit()</code></h4>
</div>
<div id="outline-container-orga583838" class="outline-4">
<h4 id="orga583838"><code>toascii()</code> // FIXME: maybe not needed</h4>
</div>
<div id="outline-container-org2943fb8" class="outline-4">
<h4 id="org2943fb8"><code>tolower()</code></h4>
</div>
<div id="outline-container-org7574aa9" class="outline-4">
<h4 id="org7574aa9"><code>toupper()</code></h4>
</div>
</div>
</div>
<div id="outline-container-org8cb7e65" class="outline-2">
<h2 id="org8cb7e65"><span class="todo TODO">TODO</span> <code>&lt;mem&gt;</code> header</h2>
<div class="outline-text-2" id="text-org8cb7e65">
<p>
Functions for memory usage (FIXME: better description)
</p>
</div>
<div id="outline-container-org06e2d62" class="outline-3">
<h3 id="org06e2d62">Types</h3>
</div>
<div id="outline-container-org8c398be" class="outline-3">
<h3 id="org8c398be">Functions</h3>
<div class="outline-text-3" id="text-org8c398be">
</div>
<div id="outline-container-org2efbe6d" class="outline-4">
<h4 id="org2efbe6d">fn alloc(Size sz) (byte[]);</h4>
</div>
<div id="outline-container-orgf2b1244" class="outline-4">
<h4 id="orgf2b1244">fn free(byte[] ptr);</h4>
</div>
</div>
</div>
<div id="outline-container-org4377cae" class="outline-2">
<h2 id="org4377cae"><span class="todo TODO">TODO</span> <code>&lt;sys&gt;</code> header</h2>
<div class="outline-text-2" id="text-org4377cae">
</div>
<div id="outline-container-org9e32f46" class="outline-3">
<h3 id="org9e32f46">Types</h3>
<div class="outline-text-3" id="text-org9e32f46">
</div>
<div id="outline-container-org64d8817" class="outline-4">
<h4 id="org64d8817">Flag</h4>
</div>
</div>
<div id="outline-container-orgd77406c" class="outline-3">
<h3 id="orgd77406c">Functions</h3>
<div class="outline-text-3" id="text-orgd77406c">
</div>
<div id="outline-container-org4d31d31" class="outline-4">
<h4 id="org4d31d31">fn open(Path p, Flag flags) (File); // FIXME: should path be path<sub>t</sub> or string? should flags be flag<sub>t</sub> or string?</h4>
</div>
<div id="outline-container-org0be8e4c" class="outline-4">
<h4 id="org0be8e4c">fn read(File f, Size sz) (byte[]); // FIXME: maybe it should return something like byte[]</h4>
</div>
<div id="outline-container-org2c0e22d" class="outline-4">
<h4 id="org2c0e22d">fn write(File f, String str, {Size sz}) (Size);</h4>
</div>
<div id="outline-container-org573a1d7" class="outline-4">
<h4 id="org573a1d7">fn close(File f) (int);</h4>
</div>
</div>
<div id="outline-container-orgea33ee0" class="outline-3">
<h3 id="orgea33ee0"><span class="todo TODO">TODO</span> <code>&lt;sys/env&gt;</code> header</h3>
</div>
<div id="outline-container-org70b66fb" class="outline-3">
<h3 id="org70b66fb"><span class="todo TODO">TODO</span> <code>&lt;sys/signal&gt;</code> header</h3>
</div>
<div id="outline-container-orgb8f0693" class="outline-3">
<h3 id="orgb8f0693"><span class="todo TODO">TODO</span> <code>&lt;sys/path&gt;</code> header</h3>
</div>
<div id="outline-container-org5ea6a03" class="outline-3">
<h3 id="org5ea6a03"><span class="todo TODO">TODO</span> <code>&lt;sys/syscall&gt;</code> header</h3>
<div class="outline-text-3" id="text-org5ea6a03">
</div>
<div id="outline-container-orga96988a" class="outline-4">
<h4 id="orga96988a">Types</h4>
</div>
<div id="outline-container-org8256c7a" class="outline-4">
<h4 id="org8256c7a">Functions</h4>
<div class="outline-text-4" id="text-org8256c7a">
</div>
<ul class="org-ul">
<li><a id="orgbcd535c"></a>fn syscall(long number, {arguments}) (long); // FIXME<br /></li>
</ul>
</div>
</div>
</div>
<div id="outline-container-orgd0d0efb" class="outline-2">
<h2 id="orgd0d0efb"><span class="todo TODO">TODO</span> <code>&lt;time&gt;</code> header</h2>
</div>
<div id="outline-container-orgfd78cb0" class="outline-2">
<h2 id="orgfd78cb0"><span class="todo TODO">TODO</span> <code>&lt;random&gt;</code> header</h2>
</div>
<div id="outline-container-org663a9a8" class="outline-2">
<h2 id="org663a9a8"><span class="todo TODO">TODO</span> <code>&lt;regex&gt;</code> header</h2>
</div>
<div id="outline-container-org2f9b363" class="outline-2">
<h2 id="org2f9b363"><span class="todo TODO">TODO</span> <code>&lt;math&gt;</code> header</h2>
</div>
<div id="outline-container-org8700ac4" class="outline-2">
<h2 id="org8700ac4"><span class="todo TODO">TODO</span> <code>&lt;error&gt;</code> header</h2>
<div class="outline-text-2" id="text-org8700ac4">
</div>
<div id="outline-container-orgbf4763f" class="outline-3">
<h3 id="orgbf4763f">Types</h3>
<div class="outline-text-3" id="text-orgbf4763f">
</div>
<div id="outline-container-org06f5f4b" class="outline-4">
<h4 id="org06f5f4b">Err // FIXME: maybe move to builtins</h4>
</div>
</div>
<div id="outline-container-org837193d" class="outline-3">
<h3 id="org837193d">Functions</h3>
</div>
</div>
<div id="outline-container-org7ab734d" class="outline-2">
<h2 id="org7ab734d"><span class="todo TODO">TODO</span> <code>&lt;num&gt;</code> header (maybe other name would be better)</h2>
<div class="outline-text-2" id="text-org7ab734d">
<p>
For bigger integers and floats
</p>
</div>
<div id="outline-container-org6620ffb" class="outline-3">
<h3 id="org6620ffb">Types</h3>
<div class="outline-text-3" id="text-org6620ffb">
</div>
<div id="outline-container-orgebfeb79" class="outline-4">
<h4 id="orgebfeb79">int8</h4>
</div>
<div id="outline-container-org6cdd5dc" class="outline-4">
<h4 id="org6cdd5dc">int16</h4>
</div>
<div id="outline-container-org128b694" class="outline-4">
<h4 id="org128b694">int32</h4>
</div>
<div id="outline-container-org893f7fe" class="outline-4">
<h4 id="org893f7fe">int64</h4>
</div>
<div id="outline-container-orgb849d32" class="outline-4">
<h4 id="orgb849d32">uint8</h4>
</div>
<div id="outline-container-org88aa40f" class="outline-4">
<h4 id="org88aa40f">uint16</h4>
</div>
<div id="outline-container-orgaa22326" class="outline-4">
<h4 id="orgaa22326">uint32</h4>
</div>
<div id="outline-container-org198cea7" class="outline-4">
<h4 id="org198cea7">uint64</h4>
</div>
<div id="outline-container-orgb57516c" class="outline-4">
<h4 id="orgb57516c">float8</h4>
</div>
<div id="outline-container-orgbb4db72" class="outline-4">
<h4 id="orgbb4db72">float16</h4>
</div>
<div id="outline-container-org22caaf5" class="outline-4">
<h4 id="org22caaf5">float32</h4>
</div>
<div id="outline-container-org70cd4fa" class="outline-4">
<h4 id="org70cd4fa">float64</h4>
</div>
</div>
<div id="outline-container-org23af794" class="outline-3">
<h3 id="org23af794">Functions</h3>
</div>
</div>
<div id="outline-container-orge8b5d42" class="outline-2">
<h2 id="orge8b5d42"><span class="todo TODO">TODO</span> <code>&lt;net&gt;</code> header (maybe should be in other library)</h2>
</div>
</div>
</body>
</html>

112
stdlib.org Normal file
View File

@ -0,0 +1,112 @@
#+OPTIONS: toc:nil num:nil <:nil \n:nil ::nil timestamp:nil *:nil ':nil
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css"/>
#+EXPORT_FILE_NAME: stdlib.html
#+TITLE: GRU DeerTree standard library specifications
* TODO Introduction
{} - optional argument to function (FIXME: should be defined in main specfications)
* TODO Buitlin syntax
* TODO ~<def>~ header
FIXME: Like stddef.h in C, maybe more
** Types
*** ~Size~ - alias for unsigned long long
* TODO ~<io>~ header
** Types
*** ~File~ - an object type used for streams.
** Functions
*** ~printf();~ // C-like formatting
*** ~fprintf();~
*** ~sprintf();~
*** ~eprintf();~
* TODO ~<string>~ header
** Types
** Functions
*** ~isalnum()~
*** ~isalpha()~
*** ~isascii()~
*** ~isblank()~
*** ~iscntrl()~ // FIXME: maybe not needed
*** ~isdigit()~
*** ~isgraph()~ // FIXME: maybe not needed
*** ~islower()~
*** ~isprint()~ // FIXME: maybe not needed
*** ~ispunct()~
*** ~isspace()~
*** ~isupper()~
*** ~isxdigit()~
*** ~toascii()~ // FIXME: maybe not needed
*** ~tolower()~
*** ~toupper()~
* TODO ~<mem>~ header
Functions for memory usage (FIXME: better description)
** Types
** Functions
*** fn alloc(Size sz) (byte[]);
*** fn free(byte[] ptr);
* TODO ~<sys>~ header
** Types
*** Flag
** Functions
*** fn open(Path p, Flag flags) (File); // FIXME: should path be path_t or string? should flags be flag_t or string?
*** fn read(File f, Size sz) (byte[]); // FIXME: maybe it should return something like byte[]
*** fn write(File f, String str, {Size sz}) (Size);
*** fn close(File f) (int);
** TODO ~<sys/env>~ header
** TODO ~<sys/signal>~ header
** TODO ~<sys/path>~ header
** TODO ~<sys/syscall>~ header
*** Types
*** Functions
**** fn syscall(long number, {arguments}) (long); // FIXME
* TODO ~<time>~ header
* TODO ~<random>~ header
* TODO ~<regex>~ header
* TODO ~<math>~ header
* TODO ~<error>~ header
** Types
*** Err // FIXME: maybe move to builtins
** Functions
* TODO ~<num>~ header (maybe other name would be better)
For bigger integers and floats
** Types
*** int8
*** int16
*** int32
*** int64
*** uint8
*** uint16
*** uint32
*** uint64
*** float8
*** float16
*** float32
*** float64
** Functions
* TODO ~<net>~ header (maybe should be in other library)

26
style.css Normal file
View File

@ -0,0 +1,26 @@
body {
background:#1c1c1c;
color:#a7d129;
font-family: 'Inconsolata', monospace;
}
div {
width:100%;
max-width:874px;
margin:24px auto;
}
hr{
color:#32302f;
}
ul{
list-style: none;
}
li{
color:#81b214;
}
a{
text-decoration:none;
color:#9ede73;
}
pre{
background: #1c1c1c;
}