Core lexical syntax Lassi Kortela 25 Sep 2019 10:15 UTC

Another proposal, this one for distilling a core lexical syntax:

Integer         [-]1234 #[box][-1]1234
Ratio           [-]1234/5678
Real            [-]1234.56 [-]123e[-]6

Plain symbol    [A-Za-z][A-Za-z0-9-_.]*
Quoted symbol   |anything here|
Quoted string   "anything here"

List            (exprs)
Improper list   (exprs . expr)
Vector          #{exprs}
Character       #\a #\newline #\x1234
Special value   #!any-plain-symbol
Special type    #any-plain-symbol{exprs}

Important: The backslash escaping for "strings" and |symbols| would
work exactly the same way, so they can re-use the same parser code.

Once again, comments and flames very welcome. The nice thing about
something this simple is, the five-page-spec "Core Sexp" subset could
have the exact same lexical syntax as the most advanced kitchen-sink
spec. The kitchen-sink spec would just add reams of special types
built out of these fundamental elements.