Tokens

Tokens are primitive productions in the grammar defined by regular (non-recursive) languages. Letlang source input can be broken down into the following kinds of tokens:

Literals

Syntax

string
" [^"\] \ [any character] "
Show source
string
  = '"' ( [^"\\] / '\\' . )* '"'
atom
@ ' [^'] \' ' [_a-zA-Z0-9]
Show source
atom
  = '@' ( ( "'" ([^'] / "\\'" )+ "'" ) / [_a-zA-Z0-9]+ )
bool
true false
Show source
bool
  = "true" / "false"
number
0b _ [01] [_01] 0o _ [0-7] [_0-7] [0-9] [_0-9] 0x _ [0-9a-fA-F] [_0-9a-fA-F] [0-9] . [0-9] . [0-9] [eE] [+-] [0-9]
Show source
number
  = ( "0b" "_"* [01] [_01]* )
  / ( "0o" "_"* [0-7] [_0-7]* )
  / ( [0-9] [_0-9]* )
  / ( "0x" "_"* [0-9a-fA-F] [_0-9a-fA-F]* )
  / ( ( ( [0-9]+ "."? [0-9]* ) / ( "." [0-9]+ ) ) ( ( [eE] [+-]? )? [0-9]+ )? )

Punctuation

Token Syntax
Module separator ::
Parenthesis (, )
Brackets [, ]
Braces ${, {, }
Comma ,
Dot .
Colon :
Semicolon ;
Arrow ->
Pattern ignore _
Ellipsis ...

Operators

Token Syntax
Match :=
Arithmetic +, -, *, /, %, **
Comparison <, <=, =, !=, >=, >
Negation !, ¬
Bitwise ~, &, |, ^, <<, >>
Logic not, and, or
String <>
Lists ++, in
Type is
Pipeline |>