cirru_edn
Extensible data notation based on Cirru syntax
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install cirru_edn
choosenim install cirru_edn
git clone https://github.com/Cirru/cirru-edn.nim
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| cirru_edn | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/Cirru/cirru-edn.nim |
|---|---|
| Homepage | https://github.com/Cirru/cirru-edn.nim |
| Registry Source | nimble_official |
README
Cirru EDN in Nim
Load Cirru EDN in Nim.
Usage
requires "cirru_edn >= 0.4.10"
import cirru_edn
parseCirruEdn("do 1") # gets 1
parseCirruEdn("[] 1 2 3")
let x = genCrEdnList(genCrEdn(1))
echo $x # stringify
type detection:
import cirru_edn
let x = parseCirruEdn("do 1") # gets 1
case x.kind:
of crEdnNil: # ...
of crEdnBool: # ...
of crEdnNumber: # ...
of crEdnKeyword: # ...
of crEdnString: # ...
of crEdnSymbol: # ...
of crEdnVector: # ...
of crEdnList: # ...
of crEdnMap: # ...
of crEdnRecord: # ...
formatToCirru(x) # returns string
formatToCirru(x, true) # turn on useInline option
Functions for generating data:
genCrEdn()
genCrEdn(true)
genCrEdn(1)
genCrEdn("a")
genCrEdnKeyword("k")
genCrEdnSymbol("s")
genCrEdnList(genCrEdn(1), genCrEdn(1))
genCrEdnVector(genCrEdn(1), genCrEdn(1))
genCrEdnSet(genCrEdn(1), genCrEdn(2))
genCrEdnMap(genCrEdnKeyword("a"), genCrEdn(2)) # even number of arguments
genCrEdnRecord("Demo", genCrEdn("a"), genCrEdn(2)) # odd number of arguments, string keys
Syntax
Cirru EDN is based on Cirru Text Syntax, on top of that is some syntax for EDN:
- Lists and vectors:
[] 1 2 3
list 1 2 3
- HashMaps:
{}
:a 1
:b 3
- Record:
Record name and record fields are represented in symbols:
%{} Demo
a 1
b 2
- Sets:
#{} 1 2 3
- Literals, since Cirru use lines for expressions, need
dofor extracting a top value:
do 1
do :k
do nil
do 'sym
- Strings, needs to be prefixed with a
|(or a single escaped"):
do |short
do "|long text"
- Quoted Cirru code(based on types from Cirru Parser):
{}
:code $ quote
def a (x y) (+ x y)
License
MIT