Skip to content
Matthew Trost edited this page Dec 19, 2015 · 2 revisions

Runiq's syntax is inspired by Lisp. There are lists, tokens, and comments. Lists are denoted by parentheses on both sides, and tokens are almost anything else (strings, numbers, etc.) separated by spaces. Comments are denoted by semicolons on both sides.

; Simple program ;
(foo (bar 1 (baz-quux 1.2 "foo bar baz")))

Save for the spaces that delimit tokens, whitespace is not significant. Lists can be nested arbitrarily. Bare tokens like foo are seen as strings unless they match a defined entity or function. For strings with spaces, use double-quote wrappers.

A list is normally understood as a function call if the first element in the list is a token and if the interpreter finds a function in the runtime library defined with that name. Subsequent tokens are the arguments.

Backtick notation can be used to inline JSON directly into the generated AST:

; Backtick example ;
(foo `{"hi": 1}`)

Square brackets can be used as a shorthand for quoting a list:

; Square brackets like this: ;
(foo [1 2 3 4])
; Are equivalent to this: ;
(foo '(1 2 3 4))
; Which is also equivalent to: ;
(foo `{"'":[1,2,3,4]}`)
Clone this wiki locally