Fork 0
Little S-Expression Framework (migrated) https://zettelstore.de/sx/
This repository has been archived on 2023-07-26. You can view files and clone it, but cannot push or open issues/pull-requests.
Go to file
Detlef Stern caf21103c6 Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
builtins Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
cmd Add Rework method to eval.Engine 2023-06-21 19:21:45 +02:00
eval Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
reader Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
.gitignore Initial commit 2022-05-01 21:46:25 +02:00
LICENSE.txt Restart 2023-01-30 15:36:12 +01:00
README.md Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
boolean.go sxpf.IsAtom(obj) -> obj.IsAtom() 2023-05-09 11:36:53 +02:00
boolean_test.go sxpf.IsAtom(obj) -> obj.IsAtom() 2023-05-09 11:36:53 +02:00
env.go Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
env_test.go Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
go.mod Update to Go1.20 2023-05-08 10:47:59 +02:00
keyword.go sxpf.IsAtom(obj) -> obj.IsAtom() 2023-05-09 11:36:53 +02:00
list.go Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
list_test.go Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
number.go sxpf.IsAtom(obj) -> obj.IsAtom() 2023-05-09 11:36:53 +02:00
number_test.go Refactor number to use int64 instead of big.Int 2023-05-08 14:18:48 +02:00
string.go sxpf.IsAtom(obj) -> obj.IsAtom() 2023-05-09 11:36:53 +02:00
sxpf.go sxpf.IsAtom(obj) -> obj.IsAtom() 2023-05-09 11:36:53 +02:00
symbol.go Rename Cell -> Pair 2023-07-11 14:51:02 +02:00
undef.go Add undefined values 2023-05-12 12:08:29 +02:00


sxpf - S-Expression Framework

This is a framework to work with s-expressions.

If you are looking to the previous work, please take a look at branch v0.


Sxpf support the following atomic, immutable types:

  • Numbers contain numeric values. Currently, only integer values are supported. There is no maximum or minimum integer value. They optionally start with a + or - sign and contain only digits 0, ..., 9.
  • Strings are UTF-8 encoded Unicode character sequences. They are delimited by " characters. Special characters inside the string, like the " character itself, are escaped by the \ character.
  • Symbols are sequences of printable / visible Unicode characters. They are typically used to bind them to values within an environment. Another use case is symbolic computation. A symbol allows to store additional values by providing an association list (a-list), a list of pairs. Symbols can be compared for equality quite efficients, since they are interned by their associated symbol factory.
  • Boolean are the symbols True and False, interpreted as boolean values. Therefore, there are no symbols with this name.
  • Keywords are sequences of printable / visible Unicode characters, starting with a & character. They are somehow in between of strings and symbols. They have a string-like value, but cannot contain special Unicode characters. They are simple enough to be like symbols, but do not contain an a-list, are not interned. They always evaluate to themself. Their use case is to act like a marker, a special value.

Sxpf supports nested lists. A list is delimited by parentheses: ( ... ). Within a list, all values are separated by space characters, including new line. Lists can be nested. Internally, lists are created by pairs. The first part of a pair, called "car", contains the actual value stored at the beginning of a list. The second part, called "cdr", typically links to the next pair. This allows multiple lists to share elements. A proper list is a list, where the last elements second part is the empty list. The last element of a list may be a pair, where the second part references a values except a list. Such lists are improper lists. Since the second part may reference any value, even earlier elements of a list, lists may be circular. Single pairs are denoted as (X . Y), where the car references S and the cdr references Y (Y is not a list).

All other types supported by Sxpf cannot be specified via the reader.