Simplifying S-Expression Grammar

^ Up

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.