Skip to content

raviqqe/arachne

Repository files navigation

Arachne

The programming language for dark mages.

Syntax

  • Atoms (e.g. 42, x)
  • Arrays (e.g. (x y z))
  • Comments (e.g. ; This is a comment.)

Types

  • Symbols (e.g. 42, x)
  • Arrays (e.g. (x y z))

Primitives

Get

(get xs 0) ; -> 42

Set

(set xs 1 42) ; -> (1 42 3)

Length

(len xs) ; -> 42

Equal

(= 0 ()) ; -> 1
(= 0 0) ; -> 1
(= 0 1) ; -> 0

If expression

(if
  condition-1 then-body-1
  condition-2 then-body-2
  else-body)

Let binding

(let foo 42)

Self recursion

(let-rec foo (fn () (foo)))

Mutual recursion

(let-rec
  foo (fn () (bar))
  bar (fn () (foo)))

Lambda expression

(fn (x y) (+ x y))

Macro definition

(macro (foo x y) `(let ,x ,y))

Quote

  • Quasi-quotation
`(foo bar) ; -> (foo bar)
(quote (foo bar)) ; -> (foo bar)

Unquote

,foo ; -> 42
(unquote foo) ; -> 42

where foo is 42.

Module import

(use "path/to/module.arc")

Design notes

References

License

The Unlicense