-
Notifications
You must be signed in to change notification settings - Fork 10
Syntax
There are six types of tokens in Charcoal - numbers, strings, variables, arrows, commands, and operators. Two or more strings or numbers can be separated by a ¦
.
These are just normal numbers, but using ·⁰¹²³⁴⁵⁶⁷⁸⁹
instead of .0123456789
. (Exponential notation is not supported.)
These are any run of printable ASCII characters and ¶
or ⸿
. Command characters can be included by escaping them with ´
. Two types of compressed strings are also available using ”
and “
delimiters, however currently the only way to create compressed strings is by deverbosifying a string. In Verbose mode, single and double quoted strings are supported, with all the standard Python escapes such as \n
and \r
.
These are any Greek lowercase letter: αβγδεζηθικλμνξπρσςτυφχψω
. These map to the Verbose variables abgdezhqiklmnxprsvtufcyw
. Note that omicron ο
has been left out because it looks too similar to an o
. Some variables have preset values.
These are any Unicode arrow: ←↑→↓↖↗↘↙
. In verbose mode, these are spelled out in words using Up
/Down
and/or Left/Right
, prefixed with a :
. Some commands accept multidirectional characters, which are any of +X*|-\/<>^KLTVY7¬
. In verbose mode, these are simply prefixed with a :
Direction
(✳
) and Directions
(✳✳
) Return a direction value for integers [0-7]
, mapped to [:Right,:Upright,:Up,:UpLeft,:Left,:DownLeft,:Down,:DownRight]
, or strings of the direction (Left
), or initials (L
), or certain prefixes (Lef
). Note that string comparison is case insensitive. Directions
takes arrays instead of single values. Note that it converts values individually, so you can have a mix of strings and integers.
These are prefix. More information can be found here (for commands) and here (for operators).
Commands can be grouped into blocks using «»
({}
in Verbose mode). Expressions can be grouped into lists using ⟦⟧
([]
in Verbose mode) or dictionaries using ⦃⦄
({}
in Verbose mode).