A permacomputing & 3D video game oriented programming language.
Go to file
zongor 3ac64d18a0 add while loops 2026-04-28 23:22:57 -07:00
arch add if / else statements 2026-04-27 22:02:37 -07:00
docs fix casting, add strings, add libundar for uxntal, add chibicc-uxn generator files, 2026-04-23 00:01:11 -07:00
emit add while loops 2026-04-28 23:22:57 -07:00
test add while loops 2026-04-28 23:22:57 -07:00
tools WIP allocator for compiler. 2026-03-22 09:27:18 -07:00
.clang-format WIP allocator for compiler. 2026-03-22 09:27:18 -07:00
.gitignore split tests into global and local 2026-04-10 23:03:54 -07:00
LICENSE Initial commit 2026-02-27 21:56:09 -05:00
README.org fix casting, add strings, add libundar for uxntal, add chibicc-uxn generator files, 2026-04-23 00:01:11 -07:00
ROADMAP.org add header gen tool, add main, add archs 2026-02-28 00:48:09 -08:00
build Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
common.h Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
compiler.c add while loops 2026-04-28 23:22:57 -07:00
compiler.h Add and, or, xor, mod, sll, srl, locals, putchar, getchar, simple if (WIP) 2026-04-22 00:15:31 -07:00
emit.h add while loops 2026-04-28 23:22:57 -07:00
lexer.c Add and, or, xor, mod, sll, srl, locals, putchar, getchar, simple if (WIP) 2026-04-22 00:15:31 -07:00
lexer.h Add and, or, xor, mod, sll, srl, locals, putchar, getchar, simple if (WIP) 2026-04-22 00:15:31 -07:00
libc.c Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
libc.h Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
list.c Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
list.h Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
strbuf.c Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00
strbuf.h Add arena return to libc, add strbuf, add reality engine rom emitter, remove C emitter 2026-04-20 23:24:38 -07:00

README.org

TITLE: Undâr Programming Language

A permacomputing & 3D video game oriented language transpiler.

Getting Started

Requirements

Main

  • C compiler that supports C89

Build

git clone https://git.alfrescocavern.com/zongor/undar-lang.git
cd undar-lang && ./build

Memory Management

All memory used by the program exists in one big bump allocator.

When a function gets called, it creates a new arena in memory starting at the end of the previous frame. (or at the beginning of memory if no function has been called)

Variables allocated in the frame's arena are owned by default by the frame they are allocated in.

When variables get modified within the current frame they will get updated in that frame in their current location in the arena.

All complex types (Plex, arrays, strings) use fat pointers where they have a header of the length of that block and a "next" ptr that refers to the next allocated block for that value

If the size of the variable changes (like adding a value to the end of a array), a link is added to the internal list that points to a new block is allocated at the end of the arena of the size of that value, so they are variable sized blocks

When a variable is passed to a child function primitive types are pass by value, complex types (Arrays, Plexes, Strings) are pass by reference.

Variables passed as arguments to the child follow the same rules except when the size of a complex type changes, then a new value is added as a link from the parent to the child and the new value is allocated at the end of the childs arena (but the owner is still the parent).

When a function "returns" the frame is deallocated and all values allocated by it is freed; thus freeing memory deterministically.

Only a single variable may be returned from a function. When a variable is returned if it is primitive it is just passed back to the parent. If it is complex the value is coalesced into a single contiguous values and the link in the parent is updated to point at the "new" end of the arena. If the parents block is at the end the entire block is coalesced into a single contiguous block.

This allows for the low resource usage of a C but the convenience of a garbage collected language like C# or Go but without the GC pauses.

Built in Types

Type Description
byte Character (architecture specific)
u8 exactly 8-bit unsigned int
i8 exactly 8-bit signed int
u16 exactly 16-bit unsigned int
i16 exactly 16-bit signed int
u32 exactly 32-bit unsigned integer
i32 exactly 32-bit signed integer
int 1 word signed number
nat 1 word unsigned number
real Q16.16 fixed-point real number
str fat pointer [length + data] string
bool true/false

License

MIT

Inspirations

  • Plan 9 / 9P - Unified I/O, Tunnels.
  • Fortran - Array semantics.
  • C / Zig - Type system, portability, control.
  • Lua - Friendly syntax, portable, and minimal VM.
  • Lox - Lexer & Parser logic.
  • Uxn - Major inspiration.
  • chibicc-uxn - Generated uxntal code for the undar-uxn libc.
  • Retro Systems - N64, PS1, Mac Classic, Windows 95 - UI esthetics