edn
===
extensible data notation [eed-n]
# Rationale
**edn** is an extensible data notation. A superset of **edn** is used by Clojure to represent
programs, and it is used by Datomic and other applications as a data transfer format. This spec
describes **edn** in isolation from those and other specific use cases, to help facilitate
implementation of readers and writers in other languages, and for other uses.
**edn** supports a rich set of built-in elements, and the definition of extension elements in terms
of the others. Users of data formats without such facilities must rely on either convention or
context to convey elements not included in the base set. This greatly complicates application
logic, betraying the apparent simplicity of the format. **edn** is simple, yet powerful enough to
meet the demands of applications without convention or complex context-sensitive logic.
**edn** is a system for the conveyance of _values_. It is not a type system, and has no schemas.
Nor is it a system for representing objects - there are no reference types, nor should a consumer
have an expectation that two equivalent elements in some body of **edn** will yield distinct object
identities when read, unless a reader implementation goes out of its way to make such a promise.
Thus the resulting values should be considered immutable, and a reader implementation should yield
values that ensure this, to the extent possible.
**edn** is a set of definitions for acceptable _elements_. A use of **edn** might be a stream or
file containing elements, but it could be as small as the conveyance of a single element in e.g. an
HTTP query param.
There is no enclosing element at the top level. Thus **edn** is suitable for streaming and
interactive applications.
The base set of elements in **edn** is meant to cover the basic set of data structures common to
most programming languages. While **edn** specifies how those elements are formatted in text, it
does not dictate the representation that results on the consumer side. A well behaved reader
library should endeavor to map the elements to programming language types with similar semantics.
# Spec
Currently this specification is casual, as we gather feedback from implementors. A more rigorous
e.g. BNF will follow.
## General considerations
**edn** elements, streams and files should be encoded using [UTF-8](http://en.wikipedia.org/wiki/UTF-8).
Elements are generally separated by whitespace. Whitespace, other than within strings, is not
otherwise significant, nor need redundant whitespace be preserved during transmissions. Commas `,`
are also considered whitespace, other than within strings.
The delimiters `{ } ( ) [ ]` need not be separated from adjacent elements by whitespace.
### # dispatch character
Tokens beginning with `#` are reserved. The character following `#` determines the behavior. The
dispatches `#{` (sets), `#_` (discard), #alphabetic-char (tag) are defined below. `#` is not a
delimiter.
## Built-in elements
### nil
`nil` represents nil, null or nothing. It should be read as an object with similar meaning on the
target platform.
### booleans
`true` and `false` should be mapped to booleans.
If a platform has canonic values for true and false, it is a further semantic of booleans that all
instances of `true` yield that (identical) value, and similarly for `false`.
### strings
Strings are enclosed in `"double quotes"`. May span multiple lines. Standard C/Java escape
characters `\t, \r, \n, \\ and \"` are supported.
### characters
Characters are preceded by a backslash: `\c`, `\newline`, `\return`, `\space` and `\tab` yield the
corresponding characters. Unicode characters are represented with \uNNNN as in Java. Backslash cannot be
followed by whitespace.
### symbols
Symbols are used to represent identifiers, and should map to something other than strings, if
possible.
Symbols begin with a non-numeric character and can contain alphanumeric characters and `. * + ! - _ ?
$ % & = < >`. If `-`, `+` or `.` are the first character, the second character (if any) must be
non-numeric. Additionally, `: #` are allowed as constituent characters in symbols other than as the
first character.
`/` has special meaning in symbols. It can be used once only in the middle of a symbol to separate
the _prefix_ (often a namespace) from the _name_, e.g. `my-namespace/foo`. `/` by itself is a legal
symbol, but otherwise neither the _prefix_ nor the _name_ part can be empty when the symbol
contains `/`.
If a symbol has a _prefix_ and `/`, the following _name_ component should follow the
first-character restrictions for symbols as a whole. This is to avoid ambiguity in reading contexts
where prefixes might be presumed as implicitly included namespaces and elided thereafter.
### keywords
Keywords are identifiers that typically designate themselves. They are semantically akin to
enumeration values. Keywords follow the rules of symbols, except they can (and must) begin with `:`, e.g. `:fred` or `:my/fred`. If the target platform does not have a keyword type distinct
from a symbol type, the same type can be used without conflict, since the mandatory leading `:` of
keywords is disallowed for symbols. Per the symbol rules above, :/ and :/anything are not legal keywords.
A keyword cannot begin with ::
If the target platform supports some notion of interning, it is a further semantic of keywords that
all instances of the same keyword yield the identical object.
### integers
Integers consist of the digits `0` - `9`, optionally prefixed by `-` to indicate a negative number, or
(redundantly) by `+`. No integer other than 0 may begin with 0. 64-bit (signed integer) precision is
expected. An integer can have the suffix `N` to indicate that arbitrary precision is desired. -0 is a
valid integer not distinct from 0.
integer
int
int N
digit
0-9
int
digit
1-9 digits
+ digit
+ 1-9 digits
- digit
- 1-9 digits
### floating point numbers
64-bit (double) precision is expected.
floating-point-number
int M
int frac
int exp
int frac exp
digit
0-9
int
digit
1-9 digits
+ digit
+ 1-9 digits
- digit
- 1-9 digits
frac
. digits
exp
ex digits
digits
digit
digit digits
ex
e
e+
e-
E
E+
E-
In addition, a floating-point number may have the suffix `M` to indicate that exact precision is
desired.
### lists
A list is a sequence of values. Lists are represented by zero or more elements enclosed in
parentheses `()`. Note that lists can be heterogeneous.
(a b 42)
### vectors
A vector is a sequence of values that supports random access. Vectors are represented by zero or
more elements enclosed in square brackets `[]`. Note that vectors can be heterogeneous.
[a b 42]
### maps
A map is a collection of associations between keys and values. Maps are represented by zero or more
key and value pairs enclosed in curly braces `{}`. Each key should appear at most once. No
semantics should be associated with the order in which the pairs appear.
{:a 1, "foo" :bar, [1 2 3] four}
Note that keys and values can be elements of any type. The use of commas above is optional, as they
are parsed as whitespace.
### sets
A set is a collection of unique values. Sets are represented by zero or more elements enclosed in
curly braces preceded by `#` `#{}`. No semantics should be associated with the order in which the
elements appear. Note that sets can be heterogeneous.
#{a b [1 2 3]}
## tagged elements
**edn** supports extensibility through a simple mechanism. `#` followed immediately by a symbol
starting with an alphabetic character indicates that _that symbol_ is a **_tag_**. A tag indicates
the semantic interpretation of _the following element_. It is envisioned that a reader
implementation will allow clients to register handlers f
没有合适的资源?快使用搜索试试~ 我知道了~
java Antlr 4 语法文件合集
共2000个文件
sql:827个
txt:421个
xml:313个
需积分: 0 0 下载量 87 浏览量
2024-04-07
17:46:43
上传
评论
收藏 27.48MB RAR 举报
温馨提示
java Antlr 4 语法文件合集
资源推荐
资源详情
资源评论
收起资源包目录
java Antlr 4 语法文件合集 (2000个子文件)
integrate.c 743B
bt.c 733B
FunctionPointer.c 525B
dialog.c 463B
ll.c 396B
FuncCallwithVarArgs.c 351B
FuncCallAsFuncArgument.c 305B
ParameterOfPointerType.c 241B
FuncForwardDeclaration.c 232B
FunctionReturningPointer.c 211B
add.c 194B
pr403.c 169B
example1.c 136B
TypeCast.c 114B
helloworld.c 68B
FunctionCall.c 65B
BinaryDigit.c 32B
example2.c 14B
Java9LexerBase.cpp 3KB
svg_dart2js.dart 127KB
web_gl_dart2js.dart 122KB
typed_data.dart 121KB
http_impl.dart 115KB
http.dart 80KB
websocket_impl.dart 41KB
http_parser.dart 38KB
http_headers.dart 32KB
websocket.dart 18KB
unmodifiable_typed_data.dart 11KB
rectangle.dart 10KB
http_date.dart 10KB
crypto.dart 9KB
math.dart 9KB
http_session.dart 5KB
point.dart 5KB
overrides.dart 4KB
Java9LexerBase.dart 3KB
random.dart 3KB
embedder_config.dart 895B
PlSqlParserBase.dart 571B
PlSqlLexerBase.dart 358B
escaped_string.dart 178B
regex2.dart 85B
escaped_backslash.dart 84B
postgresql_parser_base.go 5KB
main.go 2KB
structs.go 2KB
tjs_base_parser.go 2KB
postgresql_lexer_base.go 2KB
postgresql_parser_error_listener.go 1KB
string_stack.go 992B
tjs_base_lexer.go 977B
map_with_string.go 941B
constDecl.go 862B
forStmts.go 858B
struct_promotion.go 854B
sliceDecls.go 808B
example.go 790B
foreachStmts.go 789B
interface_inheritance.go 789B
plsql_lexer_base.go 744B
interfaces.go 742B
select.go 711B
bufChan.go 710B
statementlessLabel.go 665B
weakHash.go 643B
typeAsserts.go 619B
returnStmt.go 607B
switchesExpr.go 603B
plsql_parser_base.go 533B
defers.go 526B
varDecl.go 523B
hardcodedPassword.go 495B
multiple_type_decl.go 486B
chan.go 449B
arrayDecls.go 444B
go_parser_base.go 414B
switchesType.go 359B
shortVarDecl.go 347B
promoted.go 331B
strings.go 329B
empty_init.go 279B
maps.go 263B
params.go 240B
terminator.go 216B
method.go 213B
gostmts.go 209B
arrayEllipsisDecls.go 208B
unicodeIdentifier.go 206B
struct_with_func_type.go 203B
anonymousMethods.go 200B
postgresql_parse_error.go 121B
float.go 101B
imports.go 86B
constants.go 58B
ill_but_correct.go 56B
newline.go 44B
function.go 41B
PlSqlParserBase.h 614B
Java9LexerBase.h 434B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
qq_52308245
- 粉丝: 25
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- pta题库答案c语言之排序4统计工龄.zip
- pta题库答案c语言之树结构7堆中的路径.zip
- pta题库答案c语言之树结构3TreeTraversalsAgain.zip
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
- 以下是一个简化的示例,它使用pygame库来模拟烟花动画的框架.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功