ulng - The u language

A minimal computer language I wrote in June of 2010 to play around with a stack-based virtual machine (kind of). The output is very verbose and the only part that works right now is the interpreter - the compiler and the VM are not implemented, but the interpreter works fine :)

There are also some example programs that ship with the source release, notably the counter.ul app which lets the user enter a number and the program will count from 1 to the given input and finally calculate another value and output it as well (wow!).

Instruction set (version 0.1)

typedef enum {
    XXX = 0,
    NOP, /* no operation */
    PSH, /* push <arg> */
    POP, /* pop */
    ADD, /* add */
    MUL, /* multiply */
    NEG, /* negate */
    NOT, /* logical inversion */
    DUP, /* duplicate */
    XCH, /* exchange */
    PRN, /* print */
    INP, /* input */
    CAL, /* call subroutine by name <arg> */
    JMP, /* jump to label <arg> */
    SIZ, /* skip instruction if zero */
    ENT, /* enter function with variables: <arg> */
    LVE, /* leave function, no return value */
    RET, /* leave function, push top-of-stack to caller's stack */
    LOA, /* load from local variable <arg> (zero-based) */
    STO, /* store in local variable <arg> (zero-based) */
    LAR, /* load argument <arg> (zero-based) */
    PAR, /* pop <arg> (count) arguments from caller's stack */
} Op;


Version 0.1 is the first and initial release. Its code has been written between 2010-06-16 and 2010-06-19, but it has only been published since December 2010.


Lots. What I'd like to see in a future version should I ever happen to come around and implement it:

Thomas Perl · 2011-03-13