Astreum

Lispeum

Lispeum is a Lisp‑inspired language with postfix application and a compact low‑level stack machine. Programs are lists; the list’s tail decides how it runs.

Language At A Glance

Core Expressions

Postfix Evaluation

The Low‑Level Stack Machine

Low‑level programs are sequences of tokens. Each token is either an opcode (one of the operations below) or a literal byte string. Literals are pushed; opcodes pop arguments and push results.

Execution Model

Opcodes

Cost Model (Metering)

Building Functions

Create functions with fn. The body can emit low‑level code with sk using positional placeholders $0, $1, … for arguments.

Inline

(1 2 ( (  ; body
  $0 $1 add     ; use args 0 and 1, add
) sk ))

Named function

(
  ( a b ( ( $0 $1 add ) sk ) )  ; body
  ( a b )                       ; params
  fn
) int.add def

; call (postfix)
(1 2 int.add)   ; => 3

Examples

Add two numbers (low level)

[ 0x02 0x03 add ]   ; => 0x05

Store and load from heap

[ "k" 0x02 0x03 add heap_set  ; heap["k"] = 5
  "k" heap_get                 ; => 0x05
]

Subtraction via two’s complement in sk

( 7 4 ( ( $1 $1 nand 1 add $0 add ) sk ) )  ; 7 - 4 => 3

Back to Documentation