https://github.com/golangsam/sexpr
No, it's not about Public Relations for a popular activity.
https://github.com/golangsam/sexpr
Last synced: 3 months ago
JSON representation
No, it's not about Public Relations for a popular activity.
- Host: GitHub
- URL: https://github.com/golangsam/sexpr
- Owner: GoLangsam
- License: other
- Created: 2020-03-28T13:50:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-04T11:30:11.000Z (almost 6 years ago)
- Last Synced: 2026-01-13T18:38:34.563Z (5 months ago)
- Language: Go
- Size: 37.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sexpr
No, it's not about Public Relations for a popular activity.
It's a bluntly stolen package - originally found in "github.com/awalterschulze/gominikanren".
Package sexpr implements symbolic expressions
## API
```go
type V = *ast.Variable
type X = *ast.SExpr
func Parse(s string) (X, error)
```
Note: Expression constructors such as
func NewSymbol(s string) X
func NewVariable(s string) X
func NewList(ss ...X) X
are provided as a convenience
for test implementations only.
---
## bnf
```bnf
SExpr : Atom
| Pair
;
Pair : "(" ")"
| "(" SExpr ")"
| "(" SExpr space ContinueList ")"
| "(" SExpr space "." space SExpr ")"
;
ContinueList : SExpr
| SExpr space ContinueList
;
Atom : symbol
| int_lit
| float_lit
| string_lit
| variable
;
```
## go
```go
type SExpr struct {
*Pair
*Atom
}
type Pair struct {
Car, Cdr *SExpr
}
type Atom struct {
Str *string
Symbol *string
Float *float64
Int *int64
Var *Variable
}
```