[about document] Peculiar kind of S-expressions specification document [intended audience] beginners in programming S-expressions (Symbolic Expressions) are a fundamental concept in computer science and programming language theory. S-expressions are a simple, yet powerful notation for representing nested list data structures and code in a parenthesized form. They are commonly associated with the Lisp family of programming languages, where they serve both as a way to represent code and data uniformly. S-expr is a S-expression parsing library. Other than usual treatment of atoms and lists, it features peculiar decisions in syntax definition regarding strings, comments, and transposed blocks of contents. The general form of an S-expression is either: An atom (e.g., atom), or A list of S-expressions (e.g., (expr1 expr2 expr3)). Lists can be nested, allowing for the representation of complex hierarchical structures. For example: (eq (mul x x) (pow x 2)) This S-expression depicts equality between multiplication and square. 3. strings, comments and transposed blocks Although a great part of S-expressions power lies in its simplicity, let's introduce a few extensions in a hope of making expressed code more readable, namely: strings, comments, and transposed blocks. Strings in S-expr may be single-line or multi-line. Single-line strings are atoms enclosed in "..." pairs, like in expression "this is a single-line string", and represent Unicode format strings. Multi-line strings are enclosed between an odd number greater than 1 of " symbols in the following manner: """ this is a multi-line string """ Enclosing between a pair of """ symbols, multi-line strings are bound in a rectangle between the start of the first """ symbol, and the end of the second """ symbol. Remember to be careful when modifying contents of multi-line strings to make sure that the end of the second """ symbol is always placed horizontally behind the longest line in the string. Notice that it is also possi...
First seen: 2025-06-18 16:31
Last seen: 2025-06-19 00:49