ScratchData LogoScratchData
Back to mlcreater's profile

S-expression read/write

MLmlcreater•Created August 25, 2024
S-expression read/write
0
0
1 views
View on Scratch

Description

S-expressions are based on "Recursive functions of symbolic expressions and their computation by machine, Part I" by John McCarthy: https://doi.org/10.1145/367177.367199 I use a more modern syntax with these differences: - symbols can contain more printing characters but cannot contain spaces - spaces rather than commas separate list items - an expression preceded by an apostrophe 'x is an abbreviation for the list (quote x) The ABNF (RFC 5234) read syntax is: ;; HT, LF, VT, FF, CR, space, and exotic spaces/linebreaks wsp = %x9-d / %x20 / %x85 / %xa0 / %x1680 / %x2000-200a / %x2028-2029 / %x202f / %x205f / %x3000 apos = %x27 lparen = %x28 rparen = %x29 dot = %x2e ;; tolerated: letters, digits, and !#$%&*+-/:<=>?^_~ ;; forbidden: controls, space, non-ASCII, and "'(),.;@[\]`{|} letter = %x21 / %x23-26 / %x2a-2b / %x2d / %x2f-3a / %x3c-3f / %x41-5a / %x5e-5f / %x61-7a / %x7e atom = 1*letter wholelist = lparen *wsp list list = rparen list =/ sexpr listnext listnext = rparen listnext =/ 1*wsp listrest listrest = list listrest =/ dot 1*wsp sexpr *wsp rparen constant = apos *wsp sexpr sexpr = atom / wholelist / constant

Project Details

Project ID1059267761
CreatedAugust 25, 2024
Last ModifiedJanuary 13, 2025
SharedJanuary 13, 2025
Visibilityvisible
CommentsAllowed