reality-engine/docs/LANG.txt

1 line
3.1 KiB
Plaintext

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.