Skip to content

Instantly share code, notes, and snippets.

@twolodzko
Created June 21, 2023 07:05
Show Gist options
  • Save twolodzko/b2d26a006ac1fdd80e02d28bbc77d114 to your computer and use it in GitHub Desktop.
Save twolodzko/b2d26a006ac1fdd80e02d28bbc77d114 to your computer and use it in GitHub Desktop.
Formal syntax for a minimal Scheme
/* Play with it: https://bnfplayground.pauliankline.com/ */
<sexpr> ::= <atom> | <list> | <quote> | <unquote>
<atom> ::= <any>+
<list> ::= "(" " "* (<sexpr> " "+)* <sexpr>? ")"
<quote> ::= "'" <sexpr>
<unquote> ::= "," <sexpr>
<any> ::= <alpha> | <special>
<alpha> ::= [0-9] | [a-z] | [A-Z]
<special> ::=
"!" | "$" | "%" | "&" | "*" | "+" | "-" | "." | "/" |
":" | "<" | "=" | ">" | "?" | "@" | "^" | "_" | "~"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment