diff --git a/README.org b/README.org index 94a4737..b9c97e9 100644 --- a/README.org +++ b/README.org @@ -19,8 +19,6 @@ Undâr is a programming language for the purpose of creating 3D games and graphical user traits that work on constrained systems, microcontrollers, retro consoles, and the web using emscripten. The language emphasizes hardware longevity, energy efficiency, and the preservation of digital art and games for future generations. -It has an internal REPL that allows for quick development as well as the ability to dump the program to a binary rom for preserving that program/game/etc. - It runs on the =Reality Engine=, a VM written in freestanding C89, has a CISC like instruction format of one byte opcode and a variable byte operand. 32 local variables per frame. * Philosophy @@ -34,10 +32,10 @@ it is about using computation only when it has a strengthening effect on ecosyst Undâr is designed to ensure that programs created today will remain executable for a very long time, even through technological collapse. This is achieved through: -- A standardized bytecode format that maps 1:1 to human-readable assembly +- A standardized bytecode format that maps 1:1 to human-readable IR - A VM specification that can be implemented easily -- Hardware abstractions for the VM implementation -- ROM files that contain all necessary information for execution +- Hardware abstractions instead of a 'one size fits all'. +- ROM files that allow for a 'compile once run anywhere'. - A friendly syntax which focuses on maintaining code without obscuring functionality. * Getting Started @@ -59,14 +57,15 @@ global str terminal_namespace = "/dev/term/0"; global str new_line = "\n"; global str hello = "nuqneH 'u'?"; -function main () +function main () { str msg $0; load_address hello -> msg; call pln (msg); exit 0; +} -function pln (str message $0) +function pln (str message $0) { plex term $1; int msg_length $2; str nl $3; @@ -83,14 +82,13 @@ function pln (str message $0) string_length nl -> nl_length; syscall WRITE term nl nl_length; return; +} #+END_SRC #+BEGIN_SRC sh ./build/linux/undar-linux-debug ./test/hello.ul.ir #+END_SRC -Running the compiler without arguments will put it in "REPL" mode. It will function similar to a LISP repl. - * Memory Management memory is managed via frame based arenas. function scopes defines a memory frame. @@ -102,27 +100,28 @@ global str terminal_namespace = "/dev/term/0"; global str prompt = "Enter a string:"; global str new_line = "\n"; -function main () - int in_mode $11; - str in_term $10; +function main () { + int mode $11; + str term $10; - load_address terminal_namespace -> in_term; - load_immediate 0 -> in_mode; - syscall OPEN in_term in_mode in_term; // Terminal term = open("/dev/term/0", 0); + load_address terminal_namespace -> term; + load_immediate 0 -> mode; + syscall OPEN term mode term; load_address prompt -> $7; string_length $7 -> $8; - syscall WRITE in_term $7 $8; // print prompt + syscall WRITE term $7 $8; // print prompt str user_string $9; load_immediate 32 -> $8; malloc $8 -> user_string; - syscall READ in_term user_string $8; // read in max 32 byte string + syscall READ term user_string $8; // read max 32 byte string call pln (user_string); exit 0; +} -function pln (str message $0) +function pln (str message $0) { plex term $1; int msg_length $2; str nl $3; @@ -139,7 +138,7 @@ function pln (str message $0) string_length nl -> nl_length; syscall WRITE term nl nl_length; return; - +} #+END_SRC 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 change the parents value, unless the size of the structure changes then it will copy the parents value and append it to its own frame with the modification. this allows for the low resource usage of a C but the convenience of a Java/Go without the garbage collection. @@ -148,17 +147,20 @@ values passed to functions must be explicitly returned to propagate. heap values | Type | Description | |------+------------------------------------| +| =byte= | Character/8 bit unsigned int | +| =i8= | 8 bit signed int | +| =u16= | 16 bit unsigned int | +| =i16= | 16 bit signed int | | =int= | 32-bit signed integer | | =nat= | 32-bit natural number | | =real= | Q16.16 fixed-point real number | | =str= | fat pointer [length + data] string | | =bool= | true/false | -| =byte= | Character/8 bit unsigned int | - -A ref type allows pass by reference similar to a pointer in c. most types will be pass by value with some types being explicitly pass by reference. primitive types like int, nat, real, etc. will always be safe to change in child frames. +complex types like =str= =plex= or arrays will be =u32= pointers to their location in the 'heap' + * Roadmap [[./ROADMAP.org][Compiler, Plex, Immidate mode GUI, Constructive solid geometry, Tunnels, Actor model]] @@ -169,16 +171,14 @@ MIT-0 * Inspirations -- [[https://wiki.xxiivv.com/site/uxn.html][Uxn]] - The ideal system for permacomputing -- [[https://plan9.io/][Plan 9]] / 9P - Unified I/O, Tunnels -- [[https://forth-standard.org/][Forth]] - Shadowing -- [[https://en.wikipedia.org/wiki/Lisp_(programming_language)][Lisp]] - Live coding, REPL, introspection -- [[https://fortran-lang.org/][Fortran]] - Array semantics, scientific clarity -- [[https://en.wikipedia.org/wiki/C_(programming_language)][C]] / [[https://ziglang.org/][Zig]] - Control, minimalism -- [[https://lua.org][Lua]] - Languages can be portable and expressive without being complicated. -- [[https://www.craftinginterpreters.com/the-lox-language.html][Lox]] - The start of my programming language creation journey -- [[https://www.permacomputing.net][Permacomputing wiki]] - Core ideology -- [[http://duskos.org/][Dusk OS]] - A much better system for doing permacomputing +- [[https://plan9.io/][Plan 9]] / 9P - Unified I/O, Tunnels. +- [[https://en.wikipedia.org/wiki/Lisp_(programming_language)][Lisp]] - Live coding, REPL, introspection. +- [[https://fortran-lang.org/][Fortran]] - Array semantics. +- [[https://en.wikipedia.org/wiki/C_(programming_language)][C]] / [[https://ziglang.org/][Zig]] - Portability, control, minimalism. +- [[https://lua.org][Lua]] - Friendly syntax, portable, and minimal. +- [[https://www.craftinginterpreters.com/the-lox-language.html][Lox]] - The start of my programming language creation journey. +- [[https://wiki.xxiivv.com/site/uxn.html][Uxn]] - Major inspiration, espeically around the core VM. +- [[http://duskos.org/][Dusk OS]] - A much better system for doing permacomputing. - [[https://doc.cat-v.org/inferno/4th_edition/dis_VM_specification][Dis VM]] - CISC VM structure - Retro Systems - N64, PS1, Mac Classic, Windows 95 - UI esthetics diff --git a/ROADMAP.org b/ROADMAP.org index a85fabe..197e772 100644 --- a/ROADMAP.org +++ b/ROADMAP.org @@ -14,12 +14,6 @@ Devices should be moved into the Tunnel concept -Make it so that instead of returning the whole plex from the OPEN syscall we only return the handle - -We should remove the "refesh" options and make it so that "stat" - -Stat is the one that actually returns the plex with that info - ** Example: Hello world (=hello.ul=) *WIP syntax, not final implementation** @@ -218,7 +212,7 @@ Plexes support permacomputing by allowing the developer to use lower level trait **WIP syntax, not final implementation** -#+BEGIN_SRC ul +#+BEGIN_SRC c plex Player { str name; real[3] pos; @@ -236,14 +230,13 @@ the language is statically typed and similar to c but with some array semantic i **WIP syntax, not final implementation** -#+BEGIN_SRC ul +#+BEGIN_SRC c 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 +real[3] result = mat * pos; // compiler generates matrix-vector multiply #+END_SRC - Row-major order -- Fat pointers for slices and strings - No =vec3=/=mat4x4= structs needed - Supports composition, slicing, element-wise ops @@ -303,12 +296,6 @@ if (server.attach(auth)) { ** Actor System -*** Core Principles -- Deterministic memory management with no garbage collection or manual free -- Zero fragmentation via contiguous arena allocation -- Isolated memory spaces for all actors (no shared memory) -- Compile-time memory bounds enforcement - *** Memory Architecture - Actor memory is partitioned into fixed-size arenas - Two primary arenas: