diff options
| author | Taylan Kammer <taylan.kammer@gmail.com> | 2026-01-06 09:06:32 +0100 |
|---|---|---|
| committer | Taylan Kammer <taylan.kammer@gmail.com> | 2026-01-06 09:06:32 +0100 |
| commit | 910b1697e16bfb77a46dd39914116c5102519c41 (patch) | |
| tree | cb2361fbba5d30e1dc02096ec9f49502090eea46 /notes/260106-simpler-grammar.md | |
| parent | 71f4b9a52fc98390139330f15b632df3fdfed2ea (diff) | |
Add & update notes on new grammar.
Diffstat (limited to 'notes/260106-simpler-grammar.md')
| -rw-r--r-- | notes/260106-simpler-grammar.md | 33 |
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. |
