blob: 078ca3aacb5c7baa4a95d751da4c4d12d10a10d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
`alv` programs consist of a series of expressions separated by chunks of
whitespace. Each expression may be either a literal constant or a cell.
# literal constants
There are three types of literals with different syntax:
## numbers
Numbers consist of the digits `0`-`9` and can optionally begin with a
negative sign and contain a decimal dot. The digits before or after the
decimal point may be left off, but a number needs to consist of at least one
digit.
The following are all valid numbers:
0
12
-7
0.1
10.
.1
123.
The regular expression `-?(\d+\.\d*|\d*\.\d+|\d+)` matches all numbers.
## strings
Strings are enclosed by either single (`'`) or double quotes (`"`). Backslashes
and either type of quote can be escaped by prefixing them with a single
backslash, i.e. the literal notation `"\\\""` evaluates to the string `\"`.
The following are all valid strings:
"hello world"
'hello world'
"it's a beautiful day"
'it\'s a beautiful day'
"this is a backslash: \\"
"this is a double quote: \""
""
''
## symbols
Symbols must start with a letter (`a`-`z` or `A`-`Z`) or one of the following
special characters:
- + * /
_ . , =
! ? % $
> < ~
The remaining characters can be letters, special characters from this set, or
digits (`0`-`9`).
The following are all valid symbols:
helloWORLD
-
/
*dynamic*
*+*
var01
_test
foo$
The regular expression `[a-zA-Z\-+*\/_.,=!?%$~><][a-zA-Z0-9\-+*\/_.,=!?%$~><]*` matches all symbols.
# cells
Cells consist of any number of subexpressions separated by chunks of whitespace
and enclosed in parentheses (`(` and `)`). A cell optionally contains a tag
immediately after the opening parenthesis. Whitespace between the opening
parenthesis and the first subexpression or the closing parenthesis and the last
subexpression is optional.
## tags
Tags consist of one or more digits (`0`-`9`) enclosed in square brackets (`[`
and `]`). `[1]` and `[255]` are examples of valid tags.
# whitespace
The space, tab, newline, and line-feed special characters constitute whitespace
and may be repeated any number of times to form a chunk. A chunk of whitespace
may also contain any number of comments, but may neither begin nor end with a
comment.
## comments
A comment begins with `#(` and ends with a matching parenthesis `)`. Comments
may contain other comments or cells.
|