blob: ddfe619a1990e689d01781c8332da27dd1dbc2fc (
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
|
# Simplifying S-Expression Grammar
Supporting dots as part of identifiers and number literals, especially
at the beginning like in `...` or `.5`, but then special-casing a lone
dot for improper list syntax, is a bit annoying.
It makes my otherwise crystal clear and simple BNF grammar, as well as
my parser implementation, a bit less simple, which is bothersome.
Since I've already broken off heavily from traditional s-expressions,
I've decided to retire the dot as the improper list marker. Instead
I'll be using the ampersand.
```
;; The good old
(foo bar . baz)
;; The new kid
(foo bar & baz)
```
This is way more annoying to type, and I've not yet gotten used to the
way it looks. But you don't type improper lists frequently in code,
and I think the looks are just a matter of familiarity.
By the way, the ampersand is now illegal in identifiers. It's totally
reserved for this singular purpose in the grammar.
The only common use I know of is exception types in R6RS, which I've
never liked anyway. Using the question or exclamation marks would be
more intuitive, to express a questionable situation or a surprise!
I might walk back on this eventually, but so far it seems OK.
|