Skip to content

Syntax Reference

Complete LOVE-LANG syntax specification based on the formal ABNF grammar.

LOVE-LANG has an intentionally minimal surface syntax. It is formally defined by an ABNF grammar derived from “Forma — A Formal Naturalized Language.”


A LOVE document is a series of base statements, whitespace, and comments:

forma-doc = *(ws / comment / base-statement)

The fundamental unit of LOVE code is the base statement — assigning a value to a named key:

key = value
key is value # 'is' is an alias for '='
base-statement = key-def ws assign-op ws value ws *(newline)
assign-op = "=" / "is"
statements.love
name = "LOVE-LANG"
version = 0.0.1
active = true
description is "A linguistics-oriented programming language"

You can optionally annotate the type of any key using two syntaxes:

name @[String] = "Alice" # angle-bracket style
age :Number = 30 # colon style
type-annotation = ( "@" "[" identifier "]" )
/ ( ":" identifier )

Atom typeExampleDescription
string"hello world"Double-quoted UTF-8 string
number42, 3.14Integer or float
booleantrue, falseBoolean literal
symbol:keywordLisp-style named constant
identifiermyValueBareword reference
datetime(ISO 8601)Date/time value

LOVE uses bracket depth to encode semantic complexity and trust. This is not merely syntactic sugar — each level has a distinct meaning in the evaluator’s topology.

Simple S-expressions. Variables and primitive references.

colours = [red green blue]
pair = [1 2]
empty = []

Standard library math and pure functions. No side-effects.

sum = [[ + 1 2 3 ]]
product = [[ * 6 7 ]]
max-val = [[ Math.max [1 9 3 7] ]]

Structural schemas and type validators. Used for type checking.

UserPayload = [[[
name @[String]
email @[String]
age @[Number]
]]]

Macros and compile-time transformations. Evaluated before the programme runs.

config = [[[[
#mode Production
#target wasm
#inline true
]]]]

Side-effecting operations: file I/O, network, database writes. The highest trust level.

[[[[[
@sql_write "users" { :name "Alice" :age 30 }
]]]]]
[[[[[
@http_post "https://api.example.com/record" payload
]]]]]

The “stuff inside” brackets — forms are recursive and data-only:

form = ws / comment / atom / expression

Comments begin with # and extend to end of line:

# This is a comment
name = "LOVE" # inline comment

# Valid identifiers
myValue
my-value
my_value?
my-predicate!
# Symbols (Lisp-style keywords)
:name
:type
:active
identifier = 1*(ALPHA / "_") *ID-CHAR
ID-CHAR = ALPHA / DIGIT / "-" / "_" / "?" / "!"
symbol = ":" 1*ID-CHAR

The formal grammar is reproduced here in full from syntax.abnf:

syntax.abnf
; 1. TOP LEVEL
forma-doc = *(ws / comment / base-statement)
; 2. BASE STATEMENT
base-statement = key-def ws assign-op ws value ws *(newline)
key-def = identifier [ws type-annotation]
assign-op = "=" / "is"
value = atom / expression
; 3. TYPE ANNOTATION
type-annotation = ( "@" "[" identifier "]" )
/ ( ":" identifier )
; 4. CORE EXPRESSIONS
expression = meta-expr-5 / meta-expr-4 / macro-expr / type-expr / data-expr
data-expr = "[" *form "]"
type-expr = "[[" *form "]]"
macro-expr = "[[[" *form "]]]"
meta-expr-4 = "[[[[" *form "]]]]"
meta-expr-5 = "[[[[["*form "]]]]]"
; 5. FORM
form = ws / comment / atom / expression
; 6. ATOMS
atom = symbol / identifier / string / number / boolean / datetime
symbol = ":" 1*ID-CHAR
identifier = 1*(ALPHA / "_") *ID-CHAR
ID-CHAR = ALPHA / DIGIT / "-" / "_" / "?" / "!"
; 7. WHITESPACE & COMMENTS
ws = 1*(%x20 / %x09)
comment = "#" *(%x20-%x10FFFF) %x0A
newline = %x0A