summaryrefslogtreecommitdiff
path: root/notes/260106-simpler-grammar.md
diff options
context:
space:
mode:
Diffstat (limited to 'notes/260106-simpler-grammar.md')
-rw-r--r--notes/260106-simpler-grammar.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/notes/260106-simpler-grammar.md b/notes/260106-simpler-grammar.md
new file mode 100644
index 0000000..ddfe619
--- /dev/null
+++ b/notes/260106-simpler-grammar.md
@@ -0,0 +1,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.