'Undar' ist Undarsċieppan!

This commit is contained in:
zongor 2025-09-06 11:31:59 -07:00
parent d9725aa8d2
commit 039aa7e9f9
22 changed files with 1684 additions and 364 deletions

View File

@ -1 +0,0 @@
"Unammed Language" is a programming language for the purpose of creating three dimensional video games and graphical user interfaces that work on constrained systems, microcontrollers, retro consoles, and the using emscripten. it conforms to permacomputing principles. permacomputing encourages the maximization of hardware lifespan, minimization of energy usage and focuses on the use of already available computational resources. it values maintenance and refactoring of systems to keep them efficient, instead of planned obsolescence, permacomputing practices planned longevity. it is about using computation only when it has a strengthening effect on ecosystems. it is written in c eighty nine, has a cisc like instruction format of one byte opcode and three byte operand. thirty two general purpose registers, one stack for function calls, one stack for return values. zero initialized plexs are always valid. memory is managed via frame based arenas function scopes defines a memory frame. heap allocations push pointers within this frame. when a frame exits, the pointer is reset like stack based gc. values passed to functions must be explicitly returned to propagate. heap values are copy on write, so if a value is modified in a child function it will copy the parents value and append it to its own frame with the modification. it has a type system of nat, int, str, real. it also has a plex based on a generalized technique for symbol manipulation and numerical calculation by douglas ross, allows for efficient symbolic manipulation of data, works like a struct but syntactically looks like a class. versioning and shadowing when you redefine a plex, the old version is shadowed but preserved unless explicitly removed. the language is statically typed and similar to c but with some array semantic ideas from fortran like row major, fortran style replaces need for vec or mat. arrays are first class values, the compiler generates array multiplication code. also the idea of having a ref type to pass by reference similar to a pointer in c. it has a coroutine system that uses the yield keyword so it can do async operations. it has a abstraction layer for devices that work as system calls that can open, read, write, close, and use ioclt for extra system calls that are beyond ops. it has a abstraction called a tunnel that is inspired by plan nine. it allows files, web requests, sockets, etc. to be viewed through a simple unified interface attach open communication. clunk close communication. flush cancels long operation and dumps whatever is in buffer. open opens a tunnel for doing operations on. create creates the plex from the database graph file from file structure. read reads from a tunnel. write writes to a tunnel. remove removes the plex from the database graph file from file structure. stat returns the status of the file resource. version returns the version code for the connected tunnel. walk moves around the filesystem or through the graph. it has a built in three dimensional graphics engine based on and inspired by the werkkzeug3_kkrieger project. finally, it has a immidiate mode gui style ui system. goals are run on most things and preserve digital art and games forever. mit zero license or public domain with an ethical understanding this software should not be used to accelerate obsolescence, exploit users, or harm ecosystems.

View File

@ -1,7 +1,7 @@
#+TITLE: A Language for Enduring Realities
#+SUBTITLE: "Shape realities that outlast their makers."
#+AUTHOR: Zongor
#+EMAIL: archive@zirul-lang.org
#+EMAIL: archive@undar-lang.org
#+DATE: [2025-04-05]
#+LANGUAGE: en
#+OPTIONS: H:4 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
@ -10,10 +10,10 @@
#+PROPERTY: header-args :tangle-mode (identity #o0644)
#+BEGIN_SRC
[ · · ·
[ · · ·
· ᚱ · ·
· · ·
· · · ]
· · ·
· · · ]
#+END_SRC
* The Reality Engine
@ -45,8 +45,7 @@ This ensures:
- Perfect reproducibility
- Safe failure modes
is a permacomputing oriented, statically-typed language with **first-class arrays**, **immediate-mode semantics**, and **symbolic clarity**
Undar is a permacomputing oriented, statically-typed language with **first-class arrays**, **immediate-mode semantics**, and **symbolic clarity**
- =Constrained systems=: microcontrollers, retro consoles (PS1, N64, Mac Classic)
- =Portable environments=: Web (Emscripten), embedded, CLI
- =Permacomputing=: long-term survivability, sustainability, minimalism
@ -55,6 +54,8 @@ This ensures:
It runs on the =Reality Engine=, a minimal C89 VM inspired by Uxn, Plan 9, and Forth - but built for =spatial software=, =deterministic execution=, and =software that lasts=.
Sċieppan is a bytecode assembler that is inspired by Webassemblys WAT format.
You can view some examples in the =.lisp= files in =/test=
**Core Types**
@ -65,13 +66,13 @@ It runs on the =Reality Engine=, a minimal C89 VM inspired by Uxn, Plan 9, and F
| =real= | Q16.16 fixed-point real number |
| =str= | 4-byte packed string or fat pointer |
| =bool= | Compile-time flag |
| =ref<T>= | Reference type for passing by reference |
| =ref= | Reference type for passing by reference |
**Array Semantics (Fortran-Style)**
Arrays are **first-class values**:
#+BEGIN_SRC zrl
#+BEGIN_SRC ul
real[3] pos = [1.0, 2.0, 3.0];
real[3][3] mat = identity(3);
real[3] result = mat * pos; ! compiler generates matrix-vector multiply
@ -86,7 +87,7 @@ real[3] result = mat * pos; ! compiler generates matrix-vector multiply
Flags are compiled into **parallel arrays** (like =MultiArrayList=):
#+BEGIN_SRC zrl
#+BEGIN_SRC ul
bool[] player_alive;
real[3][] player_pos;
str[] player_name;
@ -101,7 +102,7 @@ This enables:
A =plex= is a **Platonic form** - a structured definition of a kind of being in your program.
#+BEGIN_SRC zrl
#+BEGIN_SRC ul
plex Player {
version 1;
str name;
@ -127,7 +128,7 @@ plex Player {
When you redefine a =plex=, the old version is **shadowed but preserved** - unless explicitly discarded.
#+BEGIN_SRC zrl
#+BEGIN_SRC ul
plex Counter { version 1; nat value; inc() { value += 1; } }
plex Counter { version 2; nat value; inc() { value += 2; } } ! shadows v1
@ -186,7 +187,7 @@ A =Tunnel= unifies:
- Devices
- Databases
#+BEGIN_SRC zrl
#+BEGIN_SRC ul
Tunnel server = Tunnel("tcp://localhost:25565");
if (server.attach(auth)) {
Player[] players = server.read("players");
@ -197,16 +198,17 @@ if (server.attach(auth)) {
**Tunnel Operations**
| Op | Meaning |
|------------|--------------------------------------|
| =.attach()= | Authenticate and open |
| =.open()= / =.create()= | Access/create resource |
| =.read()= / =.write()= | Transfer data |
| =.walk()= | Navigate hierarchy |
| =.flush()= | Cancel long operation |
| =.clunk()= | Close connection |
| =.stat()= | Get metadata |
| =.version()=| Get protocol version |
| Op | Meaning |
|------------|-------------------------|
| =.attach()= | Authenticate and open |
| =.open()= | Open resource |
| =.read()= |Transfer data |
| =.write()= | Transfer data |
| =.walk()= | Navigate hierarchy |
| =.flush()= | Cancel long operation |
| =.clunk()= | Close connection |
| =.stat()= | Get metadata |
| =.version()=| Get protocol version |
Tunnels make I/O **uniform, composable, and archival**.
@ -236,12 +238,12 @@ Tunnels make I/O **uniform, composable, and archival**.
git clone https://git.alfrescocavern.com/zongor/reality-engine.git
cd reality-engine
make
./zre client.zrl
./zre client.ul
#+END_SRC
**Sample Program: =hello.zrl=**
**Sample Program: =hello.ul=**
#+BEGIN_SRC zrl
#+BEGIN_SRC ul
function main(int argc, str[] argv) {
str name = argc > 1 ? argv[1] : "World";
print("Hello, {name}!");
@ -252,14 +254,14 @@ function main(int argc, str[] argv) {
Run it:
#+BEGIN_SRC sh
./zre hello.zrl Alice
./zre hello.ul Alice
# Output: Hello, Alice!
#+END_SRC
* Example: 3D Client (=client.zrl=)
* Example: 3D Client (=client.ul=)
#+BEGIN_SRC zrl
use "common.zrl";
#+BEGIN_SRC ul
use "common.ul";
function main(int argc, str[] argv) {
nat w = 800, h = 450;
@ -306,7 +308,7 @@ function main(int argc, str[] argv) {
- Versioned plexes: forward/backward compatibility
- Self-documenting syntax: just enough magic
- Open standard: no vendor lock-in
- Archive formats: =.zrl=, =.zbin=, =.zatom=
- Archive formats: =.ul=, =.zbin=, =.zatom=
* License
@ -343,6 +345,6 @@ The Reality Engine is a community project. We welcome:
* Contact
- Website: https://zirul-lang.org
- Email: archive@zirul-lang.org
- Website: https://undar-lang.org
- Email: archive@undar-lang.org
- Repository: https://git.alfrescocavern.com/zongor/reality-engine.git

1
docs/LANG.txt Normal file
View File

@ -0,0 +1 @@
undar is a programming language for the purpose of creating three dimensional video games and graphical user interfaces that work on constrained systems, microcontrollers, retro consoles, and the using emscripten. it conforms to permacomputing principles. permacomputing encourages the maximization of hardware lifespan, minimization of energy usage and focuses on the use of already available computational resources. it values maintenance and refactoring of systems to keep them efficient, instead of planned obsolescence, permacomputing practices planned longevity. it is about using computation only when it has a strengthening effect on ecosystems. it is written in c eighty nine, has a cisc like instruction format of one byte opcode and three byte operand. thirty two general purpose registers, one stack for function calls, one stack for return values. zero initialized plexs are always valid. memory is managed via frame based arenas function scopes defines a memory frame. heap allocations push pointers within this frame. when a frame exits, the pointer is reset like stack based gc. values passed to functions must be explicitly returned to propagate. heap values are copy on write, so if a value is modified in a child function it will copy the parents value and append it to its own frame with the modification. it has a type system of nat, int, str, real. it also has a plex based on a generalized technique for symbol manipulation and numerical calculation by douglas ross, allows for efficient symbolic manipulation of data, works like a struct but syntactically looks like a class. versioning and shadowing when you redefine a plex, the old version is shadowed but preserved unless explicitly removed. the language is statically typed and similar to c but with some array semantic ideas from fortran like row major, fortran style replaces need for vec or mat. arrays are first class values, the compiler generates array multiplication code. also the idea of having a ref type to pass by reference similar to a pointer in c. it has a coroutine system that uses the yield keyword so it can do async operations. it has a abstraction layer for devices that work as system calls that can open, read, write, close, and use ioclt for extra system calls that are beyond ops. it has a abstraction called a tunnel that is inspired by plan nine. it allows files, web requests, sockets, etc. to be viewed through a simple unified interface attach open communication. clunk close communication. flush cancels long operation and dumps whatever is in buffer. open opens a tunnel for doing operations on. create creates the plex from the database graph file from file structure. read reads from a tunnel. write writes to a tunnel. remove removes the plex from the database graph file from file structure. stat returns the status of the file resource. version returns the version code for the connected tunnel. walk moves around the filesystem or through the graph. goals are run on most things and preserve digital art and games forever. mit zero license or public domain with an ethical understanding this software should not be used to accelerate obsolescence, exploit users, or harm ecosystems.

View File

@ -1,128 +0,0 @@
* machine
:PROPERTIES:
:CUSTOM-ID: machine
:END:
** memory
:PROPERTIES:
:CUSTOM-ID: memory
:END:
one large uint32 array
** types
:PROPERTIES:
:CUSTOM-ID: types
:END:
real (floating point number) f32
int (integer) i32
nat (unsigned integer) u32
3-3-2 bit rgb
:PROPERTIES:
:CUSTOM-ID: bit-rgb
:END:
rrrg ggbb xxxx yyyy
triangles
textures
devices
:PROPERTIES:
:CUSTOM-ID: devices
:END:
** screen
:PROPERTIES:
:CUSTOM-ID: screen
:END:
default screen is a single 2 triangle square face with a single dynamic
texture that can be drawn on it
** keyboard
:PROPERTIES:
:CUSTOM-ID: keyboard
:END:
ASCIIUTF8 encoded values
** mousejoystick
:PROPERTIES:
:CUSTOM-ID: mousejoystick
:END:
Theoretically a modern controller could be mapped into 3 mousejoystick
devices
A nes controller could be mapped onto 1 mousejoystick device
x axis -> J1 -> J2 -> Dpad leftright y axis -> J1 -> J2 -> Dpad updown
button 1 -> A -> t1 -> select button 2 -> B -> t2 -> start button 3 -> X
-> b2 -> "meta button like controller start" button 4 -> Y -> b2 ->
unused
xxxx yyyy 1234
x (4 bits) y (4 bits) 1 is button 1 pressed? 2 is button 2 pressed? 3 is
button 3 pressed? 4 is button 4 pressed?
** soundmusic
:PROPERTIES:
:CUSTOM-ID: soundmusic
:END:
This one is going to be the hardest most likely| but its prolly going to
be something like the backend dac for ORCA.
** networkfilesystem
:PROPERTIES:
:CUSTOM-ID: networkfilesystem
:END:
9p filesystemnetwork by default.
Have an easy way to network.
** opcodes
|----------------+------------------------------------------------------|
| opcode | description |
|----------------+------------------------------------------------------|
| HALT | terminate execution |
| ADD-INT | dest = src1 + src2 |
| SUB-INT | dest = src1 - src2 |
| MUL-INT | dest = src1 src2 |
| DIV-INT | dest = src1 src2 |
| JEQ-INT | jump to address dest if src1 as int == src2 as int |
| JGT-INT | jump to address dest if src1 as int > src2 as int |
| JLT-INT | jump to address dest if src1 as int < src2 as int |
| JLE-INT | jump to address dest if src1 as int <= src2 as int |
| JGE-INT | jump to address dest if src1 as int >= src2 as int |
| INT-TO-REAL | dest = src1 as f32 |
| ADD-UINT | dest = src1 + src2 |
| SUB-UINT | dest = src1 - src2 |
| MUL-UINT | dest = src1 src2 |
| DIV-UINT | dest = src1 src2 |
| JEQ-UINT | jump to address dest if src1 as int == src2 as uint |
| JGT-UINT | jump to address dest if src1 as int > src2 as uint |
| JLT-UINT | jump to address dest if src1 as int < src2 as uint |
| JLE-UINT | jump to address dest if src1 as int <= src2 as uint |
| JGE-UINT | jump to address dest if src1 as int >= src2 as uint |
| UINT-TO-REAL | dest = src1 as f32 |
| ADD-REAL | dest = src1 + src2 |
| SUB-REAL | dest = src1 - src2 |
| MUL-REAL | dest = src1 src2 |
| DIV-REAL | dest = src1 src2 |
| JEQ-REAL | jump to address dest if src1 as real == src2 as real |
| JGE-REAL | jump to address dest if src1 as real >= src2 as real |
| JGT-REAL | jump to address dest if src1 as real > src2 as real |
| JLT-REAL | jump to address dest if src1 as real < src2 as real |
| JLE-REAL | jump to address dest if src1 as real <= src2 as real |
| REAL-TO-INT | dest = src1 as int |
| REAL-TO-UINT | dest = src1 as int |
| MOV | dest = src1 |
| JMP | jump to address src1 unconditionally |
| INT-TO-STRING | dest = src1 as str |
| UINT-TO-STRING | dest = src1 as str |
| REAL-TO-STRING | dest = src1 as str |
| READ-STRING | dest = read as str |
| PRINT-STRING | write src1 to stdout |
| CMP-STRING | dest = src1 as str == src2 as str |
| | |
|----------------+------------------------------------------------------|

View File

@ -1,51 +1,54 @@
* /ZRL/ (Reality Engine Language) Design parameters
* /Undar/ (Reality Engine Language) Design parameters
:PROPERTIES:
:CUSTOM_ID: zrl-zongors-reality-engine-language-design-parameters
:CUSTOM_ID: Undar-zongors-reality-engine-language-design-parameters
:END:
** What is /zrl/?
** What is /Undar/?
:PROPERTIES:
:CUSTOM_ID: what-is-zrl
:CUSTOM_ID: what-is-undar
:END:
/zrl/ is an domain specific language for 3D games with C/Lua style syntax.
/Undar/ is an permacomputing oriented programming language for 3D games with C style syntax.
The compiler is written in C which should make it easy to port to other
systems.
* /ZRL/ Grammar and Specification
:PROPERTIES:
:CUSTOM_ID: zrl-grammar-and-specification
:END:
** Types
:PROPERTIES:
:CUSTOM_ID: types
:END:
- there are also a list of "substantial types" which come with the
language which are the building blocks for more complex types. If you
are coming from object oriented languages you can think of self as
"primitive types"
It is short for "Undarsċieppan" The name comes from the Proto-West-Germanic word [[https://en.wiktionary.org/wiki/Reconstruction:Proto-Germanic/under][Undar]], which means "under" and [[https://en.wiktionary.org/wiki/scieppan][Sċieppan]] meaning "to create". It inspired by the idea of "Sub-creation" from Tolkien and C.S. Lewis, that the developer is sub-creating a reality for their users, whether it be a video game, office software, a website, or a embedded driver.
- Note that these look like classes but act like structs
the methods actually have a implied struct as their first argument
* /Undar/ Grammar and Specification
:PROPERTIES:
:CUSTOM_ID: undar-grammar-and-specification
:END:
** Plexs
:PROPERTIES:
:CUSTOM_ID: plexs
:END:
- A =plex= is a **Platonic form** - a structured definition of a kind of being in your program.
- Not a class: no inheritance, no vtables
- Methods are functions with implicit =this= argument
- Instances are **atoms** - persistent, versioned, serializable
- Stored in the internal graph
- "A plex defines what a thing is. An atom is its instance in that reality."
- there are also a list of "substantial plexs" which come with the
language which are the building blocks for more complex types called "Plexes". If you are coming from object oriented languages you can think of self as "primitive types"
#+begin_src zrl
type «token» {
#+begin_src ul
plex «token» {
init() {
// values
}
}
! example
type Vec3 {
plex Vec3 {
init(x real, y real, z real) {
this.x = x;
this.y = z;
this.y = z;
}
}
#+end_src zrl
#+end_src ul
* Basic Types
* Substantial Plexs
:PROPERTIES:
:CUSTOM_ID: substantial-types
:CUSTOM_ID: substantial-plexs
:END:
** numeric
:PROPERTIES:
@ -97,11 +100,11 @@ string interpolation
:CUSTOM_ID: array
:END:
Array of a specific type
Array of a specific plex
#+begin_src zrl
«type»[«length»] «variable» = [val1, val2, ...];
#+end_src zrl
#+begin_src ul
«plex»[«length»] «variable» = [val1, val2, ...];
#+end_src ul
*** Tunnel
:PROPERTIES:
@ -191,56 +194,56 @@ The following is a list of global operators and their effect:
let operator
#+begin_src zrl
#+begin_src ul
let «token» = true;
#+end_src zrl
#+end_src ul
=is=
checks if a object is of that type
checks if a atom is of that plex
#+begin_src zrl
#+begin_src ul
if («token» is real) {
print("hello yes self is a real?");
}
#+end_src zrl
#+end_src ul
also used for letting constants
=as=
coerces a type as another type if possible
coerces a plex as another plex if possible
#+begin_src zrl
#+begin_src ul
let «token» = 0; ! default is int
some_functon(«token» as real); ! needs a real
#+end_src zrl
#+end_src ul
=in=
checks if a object's type, or a type implements a contract
checks if a atom's plex, or a plex implements a contract
#+begin_src zrl
#+begin_src ul
if («token» in Tunnel, Drawable) {
print("im tunnel-able and draw-able");
}
#+end_src zrl
#+end_src ul
also used inside of the for loops
#+begin_src zrl
#+begin_src ul
for («token» in «collection») { «body» }
#+end_src zrl
#+end_src ul
** Object
** Atom
:PROPERTIES:
:CUSTOM_ID: object
:CUSTOM_ID: atom
:END:
An object is an invoked type.
An atom is an invoked plex.
#+begin_src zrl
let «variable» = «type»(«fields», …);
#+end_src zrl
#+begin_src ul
let «variable» = «plex»(«fields», …);
#+end_src ul
** Tunnel
:PROPERTIES:
@ -252,49 +255,49 @@ a socket, etc.)
Tunnels are inspired by translators in gnu/hurd, plan9 9p protocol, and
unix sockets
tunnels are invoked like objects, but have scope like control flow end
tunnels are invoked like atoms, but have scope like control flow end
scope closes the tunnel
note the type must always be of a type which is "tunnel-able"
note the plex must always be of a plex which is "tunnel-able"
i.e. Files, sockets, etc
Tunnels have almost the same interface as 9p since they are closely
based on 9p.
*** transtypes for tunnels
*** transplexs for tunnels
:PROPERTIES:
:CUSTOM_ID: transtypes-for-tunnels
:CUSTOM_ID: transplexs-for-tunnels
:END:
=tunnel? : attach(tunnel_object)= -> open communication
=tunnel? : attach(tunnel_atom)= -> open communication
=success? : tunnel_object.clunk()= -> close communication
=success? : tunnel_atom.clunk()= -> close communication
=success? : tunnel_object.flush()= -> cancels long operation and dumps
=success? : tunnel_atom.flush()= -> cancels long operation and dumps
whatever is in buffer
=success? : tunnel_object.open(resource, mode)= -> opens a tunnel for
=success? : tunnel_atom.open(resource, mode)= -> opens a tunnel for
doing operations on
=success? : tunnel_object.create(resource)= -> creates the object from
=success? : tunnel_atom.create(resource)= -> creates the atom from
the database graph/file from file structure
=data? : tunnel_object.read(resource)= -> reads from a tunnel
=data? : tunnel_atom.read(resource)= -> reads from a tunnel
=success? : tunnel_object.write(resource, data)= -> writes to a tunnel
=success? : tunnel_atom.write(resource, data)= -> writes to a tunnel
=success? : tunnel_object.remove(resource)= -> removes the object from
=success? : tunnel_atom.remove(resource)= -> removes the atom from
the database graph/file from file structure
=stat_data? : tunnel_object.stat(resource)= -> returns the status of the
=stat_data? : tunnel_atom.stat(resource)= -> returns the status of the
file/resource
=version? : tunnel_object.version()= -> returns the version code for the
=version? : tunnel_atom.version()= -> returns the version code for the
connected tunnel
=success? : tunnel_object.walk(path_or_endpoint)= -> moves around the
=success? : tunnel_atom.walk(path_or_endpoint)= -> moves around the
filesystem or through the graph
#+begin_src zrl
#+begin_src ul
! client
let endpoint = Client("tcp://path/to/source");
let tunnel = endpoint.attach(user, auth);
@ -309,24 +312,24 @@ s.bind("/some/resource", fn () str {
return "hello world";
})
server.start();
#+end_src zrl
#+end_src ul
** Functions
:PROPERTIES:
:CUSTOM_ID: functions
:END:
Functions are all typechecked statically at compile time. Since we
always have a "default type" for all constant values or a developer can
always have a "default plex" for all constant values or a developer can
use the =as= keyword we do not have to define all values like in C,
while keeping the same type safety as a more strongly typed language.
while keeping the same plex safety as a more strongly typed language.
#+begin_src zrl
fn «token» («parameter» «type», ...) «return_type» {
#+begin_src ul
fn «token» («parameter» «plex», ...) «return_plex» {
«body»
}
#+end_src zrl
#+end_src ul
- Built in transtypes
- Built in transplexs
- sort
- filter
- trig functions
@ -341,21 +344,21 @@ fn «token» («parameter» «type», ...) «return_type» {
:PROPERTIES:
:CUSTOM_ID: loops
:END:
#+begin_src zrl
#+begin_src ul
for («variable» in «collection») { «body» }
#+end_src zrl
#+end_src ul
iterates through each object in the collection setting it to variable
iterates through each atom in the collection setting it to variable
#+begin_src zrl
#+begin_src ul
while («boolean expression») { «body» }
#+end_src zrl
#+end_src ul
loops until the expression is false
#+begin_src zrl
#+begin_src ul
do («variable» = initial_value, end_value, increment) { «body» }
#+end_src zrl
#+end_src ul
loops from initial value to end value by increment value (like a for loop in other languages)
@ -363,7 +366,7 @@ loops from initial value to end value by increment value (like a for loop in oth
:PROPERTIES:
:CUSTOM_ID: branching
:END:
#+begin_src zrl
#+begin_src ul
if («boolean expression») {
} else if («boolean expression») {
@ -371,16 +374,16 @@ if («boolean expression») {
} else {
}
#+end_src zrl
#+end_src ul
#+begin_src zrl
#+begin_src ul
switch (value) {
case A:
case B:
case C:
default:
}
#+end_src zrl
#+end_src ul
** Error handling
:PROPERTIES:
@ -389,7 +392,7 @@ switch (value) {
Error handling is much like in C/C++ where a try catch can be used.
#+begin_src zrl
#+begin_src ul
let rr = nil;
let var = rr ?? 0; ! value is 0
try {
@ -398,7 +401,7 @@ try {
} catch (e) {
print("Caught error ${e}");
}
#+end_src zrl
#+end_src ul
** Localization
:PROPERTIES:
@ -406,9 +409,9 @@ try {
:END:
will look up the text of «token» in the linked localization.json file
#+begin_src zrl
#+begin_src ul
#«token»
#+end_src zrl
#+end_src ul
#+begin_src json
{
@ -429,9 +432,9 @@ will look up the text of «token» in the linked localization.json file
In most languages the include or use statements get libraries which link
to other files and so on.
#+begin_src zrl
use "./some_local_file.zrl"
#+end_src zrl
#+begin_src ul
use "./some_local_file.Undar"
#+end_src ul
** Testing
:PROPERTIES:
@ -441,9 +444,9 @@ use "./some_local_file.zrl"
:PROPERTIES:
:CUSTOM_ID: assertion
:END:
#+begin_src zrl
#+begin_src ul
assert(«expression», «expected output») ! returns «error or none»
#+end_src zrl
#+end_src ul
** Measurements
:PROPERTIES:

View File

@ -1,6 +1,6 @@
use "common.ztl";
function main(argc int, argv str[]) {
function main(int argc, str[] argv) {
nat screen_width = 800;
nat screen_height = 450;

View File

@ -1,11 +1,11 @@
!
! Note that these look like classes but act like structs
! the methods actually have a implied struct as their first argument
!
/**
* Note that these look like classes but act like structs
* the methods actually have a implied struct as their first argument
*/
!
! Camera .
!
/**
* Camera.
*/
plex Camera {
init(real[3] pos, real[3] look) {
this.setting = "CAMERA_PERSPECTIVE";
@ -16,12 +16,12 @@ plex Camera {
}
}
!
! Player .
!
/**
* Player.
*/
plex Player {
init(str username, real[3] pos, Color color) {
this.server = Client("tcp://localhost:25565");
this.client = Client("tcp://localhost:25565");
this.username = username;
this.pos = pos;
this.color = color;
@ -30,35 +30,35 @@ plex Player {
}
login(str password) Player[] { ! looks like a method but really it just has an implied "Player this" as the first argument
this.server.attach(this.username, password);
this.players = server.open("players");
this.client.attach(this.username, password);
this.players = client.open("players");
return players.read();
}
logout() {
this.players.flush();
this.server.clunk();
this.client.clunk();
}
update() {
if (key_down("right")) {
this.pos.x = this.pos.x + 0.2;
this.server.write(Command(this.username, KEY_RIGHT))
this.pos.x += 0.2;
this.client.write(Command(this.username, KEY_RIGHT))
}
if (key_down("left")) {
this.pos.x = this.pos.x - 0.2;
this.server.write(Command(this.username, KEY_LEFT))
this.pos.x -= 0.2;
this.client.write(Command(this.username, KEY_LEFT))
}
if (key_down("down")) {
this.pos.z = this.pos.z + 0.2;
this.server.write(Command(this.username, KEY_DOWN))
this.pos.z += 0.2;
this.client.write(Command(this.username, KEY_DOWN))
}
if (key_down("up")) {
this.pos.z = this.pos.z - 0.2;
this.server.write(Command(this.username, KEY_UP))
this.pos.z -= 0.2;
this.client.write(Command(this.username, KEY_UP))
}
this.camera.sync();
}

View File

@ -3,7 +3,7 @@ use "common.ztl";
function main(int argc, str[] argv) {
Server s("tcp://0.0.0.0:25565");
bool running = true;
Player[] players = [Player("user", [0., 0., 0.], RED)];
Player[] players = [Player("user", [0.0, 0.0, 0.0], RED)];
while (running) {
if (Client client = s.accept("players")) {
if (Message message = client.get()) {

732
docs/undarsċieppan-w.svg Normal file
View File

@ -0,0 +1,732 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="159.448px"
height="94.120px"
viewBox="0 -2850 8809.5 5200"
version="1.1"
id="svg45"
sodipodi:docname="equation.svg"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview45"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="5.5369495"
inkscape:cx="68.358941"
inkscape:cy="52.465713"
inkscape:window-width="1991"
inkscape:window-height="932"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="g30" />
<defs
id="defs1">
<path
id="MJX-5-NCM-N-23A1"
d="M614 1500L321 1500L321 0L387 0L387 1432L614 1432C636 1432 647 1443 647 1466C647 1485 633 1500 614 1500Z" />
<path
id="MJX-5-NCM-N-23A3"
d="M614 68L387 68L387 1500L321 1500L321 0L614 0C636 0 647 11 647 34C647 53 633 68 614 68Z" />
<path
id="MJX-5-NCM-N-23A2"
d="M321 0L387 0L387 1000L321 1000Z" />
<path
id="MJX-5-NCM-N-22C5"
d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z" />
<path
id="MJX-5-NCM-N-23A4"
d="M280 0L346 0L346 1500L53 1500C31 1500 20 1489 20 1466C20 1443 31 1432 53 1432L280 1432Z" />
<path
id="MJX-5-NCM-N-23A6"
d="M53 0L346 0L346 1500L280 1500L280 68L53 68C31 68 20 57 20 34C20 11 31 0 53 0Z" />
<path
id="MJX-5-NCM-N-23A5"
d="M280 0L346 0L346 1000L280 1000Z" />
</defs>
<g
stroke="#FFFFFF"
fill="#FFFFFF"
stroke-width="0"
transform="scale(1,-1)"
id="g45">
<g
data-mml-node="math"
data-latex="\begin{bmatrix} ᚢ &amp; \cdot &amp; \cdot &amp; \cdot \\ \cdot &amp;&amp; \cdot &amp; \cdot \\ \cdot &amp; \cdot &amp;&amp; \cdot \\ \cdot &amp; \cdot &amp; \cdot &amp; ᚾ \end{bmatrix}"
data-semantic-structure="(37 0 (9 (2 1) (4 3) (6 5) (8 7)) (18 (11 10) (13 12) (15 14) (17 16)) (27 (20 19) (22 21) (24 23) (26 25)) (36 (29 28) (31 30) (33 32) (35 34)) 38)"
id="g44">
<g
data-mml-node="TeXAtom"
data-mjx-texclass="INNER"
data-latex-item="{bmatrix}"
data-latex="\begin{bmatrix} ᚢ &amp; \cdot &amp; \cdot &amp; \cdot \\ \cdot &amp;&amp; \cdot &amp; \cdot \\ \cdot &amp; \cdot &amp;&amp; \cdot \\ \cdot &amp; \cdot &amp; \cdot &amp; ᚾ \end{bmatrix}"
data-semantic-type="matrix"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:1"
data-semantic-id="37"
data-semantic-children="9,18,27,36"
data-semantic-content="0,38"
data-semantic-attributes="latex:\begin{bmatrix} ᚢ &amp; \cdot &amp; \cdot &amp; \cdot \\ \cdot &amp;&amp; \cdot &amp; \cdot \\ \cdot &amp; \cdot &amp;&amp; \cdot \\ \cdot &amp; \cdot &amp; \cdot &amp; ᚾ \end{bmatrix};texclass:INNER"
data-semantic-owns="0 9 18 27 36 38"
aria-level="0"
data-speech-node="true"
id="g43">
<g
data-mml-node="mo"
data-mjx-texclass="OPEN"
data-semantic-type="fence"
data-semantic-role="open"
data-semantic-annotation="depth:2"
data-semantic-id="0"
data-semantic-parent="37"
data-semantic-attributes="texclass:OPEN"
aria-level="1"
data-speech-node="true"
id="g3"
transform="translate(662.99988)">
<use
data-c="23A1"
xlink:href="#MJX-5-NCM-N-23A1"
transform="translate(0,1350)"
id="use1" />
<use
data-c="23A3"
xlink:href="#MJX-5-NCM-N-23A3"
transform="translate(0,-2350)"
id="use2" />
<svg
width="667"
height="2400"
y="-950"
x="0"
viewBox="0 600 667 2400"
version="1.1"
id="svg3">
<use
data-c="23A2"
xlink:href="#MJX-5-NCM-N-23A2"
transform="scale(1,3.6)"
id="use3" />
</svg>
</g>
<g
data-mml-node="mtable"
transform="matrix(0.86153012,0,0,1,1268.3375,0)"
id="g40">
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="9"
data-semantic-children="2,4,6,8"
data-semantic-parent="37"
data-semantic-owns="2 4 6 8"
aria-level="1"
data-speech-node="true"
transform="translate(0,2100)"
id="g12">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="2"
data-semantic-children="1"
data-semantic-parent="9"
data-semantic-owns="1"
aria-level="2"
data-speech-node="true"
id="g5"
transform="translate(256.52028)">
<g
data-mml-node="mi"
data-latex="ᚢ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="1"
data-semantic-parent="2"
data-semantic-attributes="latex:ᚢ"
aria-level="3"
data-speech-node="true"
id="g4">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text3">ᚢ</text>
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="4"
data-semantic-children="3"
data-semantic-parent="9"
data-semantic-owns="3"
aria-level="2"
data-speech-node="true"
transform="translate(2587.6)"
id="g7">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="3"
data-semantic-parent="4"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g6">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use5" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="6"
data-semantic-children="5"
data-semantic-parent="9"
data-semantic-owns="5"
aria-level="2"
data-speech-node="true"
transform="translate(4698.1)"
id="g9">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="5"
data-semantic-parent="6"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g8">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use7" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="8"
data-semantic-children="7"
data-semantic-parent="9"
data-semantic-owns="7"
aria-level="2"
data-speech-node="true"
transform="translate(6555.1798)"
id="g11">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="7"
data-semantic-parent="8"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g10">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use9" />
</g>
</g>
</g>
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="18"
data-semantic-children="11,13,15,17"
data-semantic-parent="37"
data-semantic-owns="11 13 15 17"
aria-level="1"
data-speech-node="true"
transform="translate(0,700)"
id="g21">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="11"
data-semantic-children="10"
data-semantic-parent="18"
data-semantic-owns="10"
aria-level="2"
data-speech-node="true"
transform="translate(463.5)"
id="g14">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="10"
data-semantic-parent="11"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g13">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use12" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="13"
data-semantic-children="12"
data-semantic-parent="18"
data-semantic-owns="12"
aria-level="2"
data-speech-node="true"
transform="translate(2461.5202)"
id="g16">
<g
data-mml-node="mi"
data-latex="ᚱ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="12"
data-semantic-parent="13"
data-semantic-attributes="latex:ᚱ"
aria-level="3"
data-speech-node="true"
id="g15">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text14">ᚱ</text>
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="15"
data-semantic-children="14"
data-semantic-parent="18"
data-semantic-owns="14"
aria-level="2"
data-speech-node="true"
transform="translate(4698.1)"
id="g18">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="14"
data-semantic-parent="15"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g17">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use16" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="17"
data-semantic-children="16"
data-semantic-parent="18"
data-semantic-owns="16"
aria-level="2"
data-speech-node="true"
transform="translate(6555.1798)"
id="g20">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="16"
data-semantic-parent="17"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g19">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use18" />
</g>
</g>
</g>
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="27"
data-semantic-children="20,22,24,26"
data-semantic-parent="37"
data-semantic-owns="20 22 24 26"
aria-level="1"
data-speech-node="true"
transform="translate(0,-700)"
id="g30">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="20"
data-semantic-children="19"
data-semantic-parent="27"
data-semantic-owns="19"
aria-level="2"
data-speech-node="true"
transform="translate(463.5)"
id="g23">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="19"
data-semantic-parent="20"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g22">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use21" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="22"
data-semantic-children="21"
data-semantic-parent="27"
data-semantic-owns="21"
aria-level="2"
data-speech-node="true"
transform="translate(2587.6)"
id="g25">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="21"
data-semantic-parent="22"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g24">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use23" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="24"
data-semantic-children="23"
data-semantic-parent="27"
data-semantic-owns="23"
aria-level="2"
data-speech-node="true"
transform="translate(4504.7202)"
id="g27">
<g
data-mml-node="mi"
data-latex="ᛋ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="23"
data-semantic-parent="24"
data-semantic-attributes="latex:ᛋ"
aria-level="3"
data-speech-node="true"
id="g26">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text25">ᛋ</text>
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="26"
data-semantic-children="25"
data-semantic-parent="27"
data-semantic-owns="25"
aria-level="2"
data-speech-node="true"
transform="translate(6555.1798)"
id="g29">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="25"
data-semantic-parent="26"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g28">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use27" />
</g>
</g>
</g>
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="36"
data-semantic-children="29,31,33,35"
data-semantic-parent="37"
data-semantic-owns="29 31 33 35"
aria-level="1"
data-speech-node="true"
transform="translate(0,-2100)"
id="g39">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="29"
data-semantic-children="28"
data-semantic-parent="36"
data-semantic-owns="28"
aria-level="2"
data-speech-node="true"
transform="translate(463.5)"
id="g32">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="28"
data-semantic-parent="29"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g31">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use30" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="31"
data-semantic-children="30"
data-semantic-parent="36"
data-semantic-owns="30"
aria-level="2"
data-speech-node="true"
transform="translate(2587.6)"
id="g34">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="30"
data-semantic-parent="31"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g33">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use32" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="33"
data-semantic-children="32"
data-semantic-parent="36"
data-semantic-owns="32"
aria-level="2"
data-speech-node="true"
transform="translate(4698.1)"
id="g36">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="32"
data-semantic-parent="33"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g35">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use34" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="35"
data-semantic-children="34"
data-semantic-parent="36"
data-semantic-owns="34"
aria-level="2"
data-speech-node="true"
transform="translate(6426)"
id="g38">
<g
data-mml-node="mi"
data-latex="ᚾ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="34"
data-semantic-parent="35"
data-semantic-attributes="latex:ᚾ"
aria-level="3"
data-speech-node="true"
id="g37">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text36">ᚾ</text>
</g>
</g>
</g>
</g>
<g
data-mml-node="mo"
data-mjx-texclass="CLOSE"
data-semantic-type="fence"
data-semantic-role="close"
data-semantic-annotation="depth:2"
data-semantic-id="38"
data-semantic-parent="37"
data-semantic-attributes="texclass:CLOSE"
aria-level="1"
data-speech-node="true"
transform="translate(7369)"
id="g42">
<use
data-c="23A4"
xlink:href="#MJX-5-NCM-N-23A4"
transform="translate(0,1350)"
id="use40" />
<use
data-c="23A6"
xlink:href="#MJX-5-NCM-N-23A6"
transform="translate(0,-2350)"
id="use41" />
<svg
width="667"
height="2400"
y="-950"
x="0"
viewBox="0 600 667 2400"
version="1.1"
id="svg42">
<use
data-c="23A5"
xlink:href="#MJX-5-NCM-N-23A5"
transform="scale(1,3.6)"
id="use42" />
</svg>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 26 KiB

732
docs/undarsċieppan.svg Normal file
View File

@ -0,0 +1,732 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="159.448px"
height="94.120px"
viewBox="0 -2850 8809.5 5200"
version="1.1"
id="svg45"
sodipodi:docname="equation.svg"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview45"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="5.5369495"
inkscape:cx="68.358941"
inkscape:cy="52.465713"
inkscape:window-width="1991"
inkscape:window-height="932"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="g30" />
<defs
id="defs1">
<path
id="MJX-5-NCM-N-23A1"
d="M614 1500L321 1500L321 0L387 0L387 1432L614 1432C636 1432 647 1443 647 1466C647 1485 633 1500 614 1500Z" />
<path
id="MJX-5-NCM-N-23A3"
d="M614 68L387 68L387 1500L321 1500L321 0L614 0C636 0 647 11 647 34C647 53 633 68 614 68Z" />
<path
id="MJX-5-NCM-N-23A2"
d="M321 0L387 0L387 1000L321 1000Z" />
<path
id="MJX-5-NCM-N-22C5"
d="M192 250C192 279 168 303 139 303C110 303 86 279 86 250C86 221 110 197 139 197C168 197 192 221 192 250Z" />
<path
id="MJX-5-NCM-N-23A4"
d="M280 0L346 0L346 1500L53 1500C31 1500 20 1489 20 1466C20 1443 31 1432 53 1432L280 1432Z" />
<path
id="MJX-5-NCM-N-23A6"
d="M53 0L346 0L346 1500L280 1500L280 68L53 68C31 68 20 57 20 34C20 11 31 0 53 0Z" />
<path
id="MJX-5-NCM-N-23A5"
d="M280 0L346 0L346 1000L280 1000Z" />
</defs>
<g
stroke="#000000"
fill="#000000"
stroke-width="0"
transform="scale(1,-1)"
id="g45">
<g
data-mml-node="math"
data-latex="\begin{bmatrix} ᚢ &amp; \cdot &amp; \cdot &amp; \cdot \\ \cdot &amp;&amp; \cdot &amp; \cdot \\ \cdot &amp; \cdot &amp;&amp; \cdot \\ \cdot &amp; \cdot &amp; \cdot &amp; ᚾ \end{bmatrix}"
data-semantic-structure="(37 0 (9 (2 1) (4 3) (6 5) (8 7)) (18 (11 10) (13 12) (15 14) (17 16)) (27 (20 19) (22 21) (24 23) (26 25)) (36 (29 28) (31 30) (33 32) (35 34)) 38)"
id="g44">
<g
data-mml-node="TeXAtom"
data-mjx-texclass="INNER"
data-latex-item="{bmatrix}"
data-latex="\begin{bmatrix} ᚢ &amp; \cdot &amp; \cdot &amp; \cdot \\ \cdot &amp;&amp; \cdot &amp; \cdot \\ \cdot &amp; \cdot &amp;&amp; \cdot \\ \cdot &amp; \cdot &amp; \cdot &amp; ᚾ \end{bmatrix}"
data-semantic-type="matrix"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:1"
data-semantic-id="37"
data-semantic-children="9,18,27,36"
data-semantic-content="0,38"
data-semantic-attributes="latex:\begin{bmatrix} ᚢ &amp; \cdot &amp; \cdot &amp; \cdot \\ \cdot &amp;&amp; \cdot &amp; \cdot \\ \cdot &amp; \cdot &amp;&amp; \cdot \\ \cdot &amp; \cdot &amp; \cdot &amp; ᚾ \end{bmatrix};texclass:INNER"
data-semantic-owns="0 9 18 27 36 38"
aria-level="0"
data-speech-node="true"
id="g43">
<g
data-mml-node="mo"
data-mjx-texclass="OPEN"
data-semantic-type="fence"
data-semantic-role="open"
data-semantic-annotation="depth:2"
data-semantic-id="0"
data-semantic-parent="37"
data-semantic-attributes="texclass:OPEN"
aria-level="1"
data-speech-node="true"
id="g3"
transform="translate(662.99988)">
<use
data-c="23A1"
xlink:href="#MJX-5-NCM-N-23A1"
transform="translate(0,1350)"
id="use1" />
<use
data-c="23A3"
xlink:href="#MJX-5-NCM-N-23A3"
transform="translate(0,-2350)"
id="use2" />
<svg
width="667"
height="2400"
y="-950"
x="0"
viewBox="0 600 667 2400"
version="1.1"
id="svg3">
<use
data-c="23A2"
xlink:href="#MJX-5-NCM-N-23A2"
transform="scale(1,3.6)"
id="use3" />
</svg>
</g>
<g
data-mml-node="mtable"
transform="matrix(0.86153012,0,0,1,1268.3375,0)"
id="g40">
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="9"
data-semantic-children="2,4,6,8"
data-semantic-parent="37"
data-semantic-owns="2 4 6 8"
aria-level="1"
data-speech-node="true"
transform="translate(0,2100)"
id="g12">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="2"
data-semantic-children="1"
data-semantic-parent="9"
data-semantic-owns="1"
aria-level="2"
data-speech-node="true"
id="g5"
transform="translate(256.52028)">
<g
data-mml-node="mi"
data-latex="ᚢ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="1"
data-semantic-parent="2"
data-semantic-attributes="latex:ᚢ"
aria-level="3"
data-speech-node="true"
id="g4">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text3">ᚢ</text>
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="4"
data-semantic-children="3"
data-semantic-parent="9"
data-semantic-owns="3"
aria-level="2"
data-speech-node="true"
transform="translate(2587.6)"
id="g7">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="3"
data-semantic-parent="4"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g6">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use5" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="6"
data-semantic-children="5"
data-semantic-parent="9"
data-semantic-owns="5"
aria-level="2"
data-speech-node="true"
transform="translate(4698.1)"
id="g9">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="5"
data-semantic-parent="6"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g8">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use7" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="8"
data-semantic-children="7"
data-semantic-parent="9"
data-semantic-owns="7"
aria-level="2"
data-speech-node="true"
transform="translate(6555.1798)"
id="g11">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="7"
data-semantic-parent="8"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g10">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use9" />
</g>
</g>
</g>
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="18"
data-semantic-children="11,13,15,17"
data-semantic-parent="37"
data-semantic-owns="11 13 15 17"
aria-level="1"
data-speech-node="true"
transform="translate(0,700)"
id="g21">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="11"
data-semantic-children="10"
data-semantic-parent="18"
data-semantic-owns="10"
aria-level="2"
data-speech-node="true"
transform="translate(463.5)"
id="g14">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="10"
data-semantic-parent="11"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g13">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use12" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="13"
data-semantic-children="12"
data-semantic-parent="18"
data-semantic-owns="12"
aria-level="2"
data-speech-node="true"
transform="translate(2461.5202)"
id="g16">
<g
data-mml-node="mi"
data-latex="ᚱ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="12"
data-semantic-parent="13"
data-semantic-attributes="latex:ᚱ"
aria-level="3"
data-speech-node="true"
id="g15">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text14">ᚱ</text>
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="15"
data-semantic-children="14"
data-semantic-parent="18"
data-semantic-owns="14"
aria-level="2"
data-speech-node="true"
transform="translate(4698.1)"
id="g18">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="14"
data-semantic-parent="15"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g17">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use16" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="17"
data-semantic-children="16"
data-semantic-parent="18"
data-semantic-owns="16"
aria-level="2"
data-speech-node="true"
transform="translate(6555.1798)"
id="g20">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="16"
data-semantic-parent="17"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g19">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use18" />
</g>
</g>
</g>
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="27"
data-semantic-children="20,22,24,26"
data-semantic-parent="37"
data-semantic-owns="20 22 24 26"
aria-level="1"
data-speech-node="true"
transform="translate(0,-700)"
id="g30">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="20"
data-semantic-children="19"
data-semantic-parent="27"
data-semantic-owns="19"
aria-level="2"
data-speech-node="true"
transform="translate(463.5)"
id="g23">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="19"
data-semantic-parent="20"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g22">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use21" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="22"
data-semantic-children="21"
data-semantic-parent="27"
data-semantic-owns="21"
aria-level="2"
data-speech-node="true"
transform="translate(2587.6)"
id="g25">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="21"
data-semantic-parent="22"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g24">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use23" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="24"
data-semantic-children="23"
data-semantic-parent="27"
data-semantic-owns="23"
aria-level="2"
data-speech-node="true"
transform="translate(4504.7202)"
id="g27">
<g
data-mml-node="mi"
data-latex="ᛋ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="23"
data-semantic-parent="24"
data-semantic-attributes="latex:ᛋ"
aria-level="3"
data-speech-node="true"
id="g26">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text25">ᛋ</text>
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="26"
data-semantic-children="25"
data-semantic-parent="27"
data-semantic-owns="25"
aria-level="2"
data-speech-node="true"
transform="translate(6555.1798)"
id="g29">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="25"
data-semantic-parent="26"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g28">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use27" />
</g>
</g>
</g>
<g
data-mml-node="mtr"
data-semantic-type="row"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:2"
data-semantic-id="36"
data-semantic-children="29,31,33,35"
data-semantic-parent="37"
data-semantic-owns="29 31 33 35"
aria-level="1"
data-speech-node="true"
transform="translate(0,-2100)"
id="g39">
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="29"
data-semantic-children="28"
data-semantic-parent="36"
data-semantic-owns="28"
aria-level="2"
data-speech-node="true"
transform="translate(463.5)"
id="g32">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="28"
data-semantic-parent="29"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g31">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use30" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="31"
data-semantic-children="30"
data-semantic-parent="36"
data-semantic-owns="30"
aria-level="2"
data-speech-node="true"
transform="translate(2587.6)"
id="g34">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="30"
data-semantic-parent="31"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g33">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use32" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="33"
data-semantic-children="32"
data-semantic-parent="36"
data-semantic-owns="32"
aria-level="2"
data-speech-node="true"
transform="translate(4698.1)"
id="g36">
<g
data-mml-node="mo"
data-latex="\cdot"
data-semantic-type="operator"
data-semantic-role="multiplication"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="32"
data-semantic-parent="33"
data-semantic-attributes="latex:\cdot"
aria-level="3"
data-speech-node="true"
id="g35">
<use
data-c="22C5"
xlink:href="#MJX-5-NCM-N-22C5"
id="use34" />
</g>
</g>
<g
data-mml-node="mtd"
data-semantic-type="cell"
data-semantic-role="squarematrix"
data-semantic-annotation="depth:3"
data-semantic-id="35"
data-semantic-children="34"
data-semantic-parent="36"
data-semantic-owns="34"
aria-level="2"
data-speech-node="true"
transform="translate(6426)"
id="g38">
<g
data-mml-node="mi"
data-latex="ᚾ"
data-semantic-type="identifier"
data-semantic-role="unknown"
data-semantic-annotation="nemeth:number;depth:4"
data-semantic-id="34"
data-semantic-parent="35"
data-semantic-attributes="latex:ᚾ"
aria-level="3"
data-speech-node="true"
id="g37">
<text
data-variant="italic"
transform="scale(1,-1)"
font-size="884px"
font-family="serif"
font-style="italic"
id="text36">ᚾ</text>
</g>
</g>
</g>
</g>
<g
data-mml-node="mo"
data-mjx-texclass="CLOSE"
data-semantic-type="fence"
data-semantic-role="close"
data-semantic-annotation="depth:2"
data-semantic-id="38"
data-semantic-parent="37"
data-semantic-attributes="texclass:CLOSE"
aria-level="1"
data-speech-node="true"
transform="translate(7369)"
id="g42">
<use
data-c="23A4"
xlink:href="#MJX-5-NCM-N-23A4"
transform="translate(0,1350)"
id="use40" />
<use
data-c="23A6"
xlink:href="#MJX-5-NCM-N-23A6"
transform="translate(0,-2350)"
id="use41" />
<svg
width="667"
height="2400"
y="-950"
x="0"
viewBox="0 600 667 2400"
version="1.1"
id="svg42">
<use
data-c="23A5"
xlink:href="#MJX-5-NCM-N-23A5"
transform="scale(1,3.6)"
id="use42" />
</svg>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,17 +0,0 @@
main:
lodi $0 1 ;load 1 into r0
pshi $0 ;push onto stack
lodi $0 1 ;1
pshi $0
call &add ; call memory location for tag "add"
popi $0 ;get value from function call "add"
itos $1 $0 ;convert int to string
puts $1 ;print string to stdout
halt
add:
popi $0 ; int a
popi $1 ; int b
addi $2 $1 $0 ; a + b
pshi $2
retn ; actually do the return

View File

@ -1,5 +1,17 @@
(defun add (int a int b)
(return (+ a b)))
main:
lodi $0 1 ;load 1 into r0
pshi $0 ;push onto stack
lodi $0 1 ;1
pshi $0
call &add ; call memory location for tag "add"
popi $0 ;get value from function call "add"
itos $1 $0 ;convert int to string
puts $1 ;print string to stdout
halt
(let ((sum (add 1 1)))
(print (itos sum)))
add:
popi $0 ; int a
popi $1 ; int b
addi $2 $1 $0 ; a + b
pshi $2
retn ; actually do the return

View File

@ -1,29 +0,0 @@
main:
lodi $0 35
pshi $0
call &fib
popi $0
itos $1 $0
puts $1
halt
fib:
popi $0
lodi $1 2
lodi $2 &base_case
jlti $2 $0 $1
lodi $2 2
subi $4 $0 $3
pshi $4
call &fib
lodi $2 1
subi $4 $0 $3
pshi $4
call &fib
popi $4
popi $5
addi $6 $5 $4
pshi $6
retn
base_case:
pshi $0
retn

View File

@ -1,7 +1,29 @@
(defun fib (int n)
(if (n < 2)
(return n)
(return (+ (fib (- n 2))
(fib (- n 1))))))
(puts (itos (fib 35)))
main:
lodi $0 35
pshi $0
call &fib
popi $0
itos $1 $0
puts $1
halt
fib:
popi $0
lodi $1 2
lodi $2 &base_case
jlti $2 $0 $1
lodi $2 2
subi $4 $0 $3
pshi $4
call &fib
lodi $2 1
subi $4 $0 $3
pshi $4
call &fib
popi $4
popi $5
addi $6 $5 $4
pshi $6
retn
base_case:
pshi $0
retn

View File

@ -1,22 +0,0 @@
main:
lodr $0 5.0
lodi $1 50000
lodi $2 0
lodi $3 -1
loop_body:
lodr $5 5.0
addr $0 $0 $5
addi $1 $1 $3
lodu $4 &loop_body
jgei $4 $1 $2
rtou $1 $0
strs "Enter a string:"
ladu $5 0
puts $5
gets $2
utos $3 $1
puts $3
rtos $3 $0
puts $3
puts $2
halt

View File

@ -1,9 +1,22 @@
(let ((a 5.0))
(do (i (5000 0 -1))
(set a (+ a 5.0)))
(let ((b (itou a)))
(puts "Enter a string:")
(let ((user-string (gets)))
(puts (rtos a))
(puts (utos b))
(puts user-string))))
main:
lodr $0 5.0
lodi $1 50000
lodi $2 0
lodi $3 -1
loop_body:
lodr $5 5.0
addr $0 $0 $5
addi $1 $1 $3
lodu $4 &loop_body
jgei $4 $1 $2
rtou $1 $0
strs "Enter a string:"
ladu $5 0
puts $5
gets $2
utos $3 $1
puts $3
rtos $3 $0
puts $3
puts $2
halt