Data-E in JSON

From Erights

Revision as of 13:22, 29 May 2009 by Kevin Reid (Talk | contribs)
Jump to: navigation, search

There is interest (2009-01-07) in using CapTP in Cajita systems, with a JSON syntax for the message/serialization layer. Therefore, this page defines a JSON syntax for Data-E.

Except for literals and that it uses tuples with string tags instead of TermL tagged terms, it is exactly the same as the Data-E in TermL format as implemented by deASTKit.

Contents

Literals

String literals are copied as-is into JSON (rationale: compactness, readability). Characters are tagged since JSON does not have character values. Integers are tagged and written as strings since JavaScript-based JSON implementations will not preserve the values of integers that don't fit in float64.

XXX justify or remove tagging of float64.

XXX review what base/format to write integers in. In particular, if there is such, it should be readily convertible to a the format used by some big-integer-in-JavaScript library.

Data-E Source JSON
String "foo" "foo"
Integer 9 ["int", "9"]
Float64 9.99 ["float64", 9.99]
Character 'f' ["char", "f"]

Import and ibid

Data-E Source JSON
foo ["import", "foo"]
t_9 ["ibid", 9]

Call

Data-E Source JSON
foo.bar(baz...) ["call", foo, "bar", [baz...]]

Define

Data-E Source JSON
def t_9 := bar ["define", 9, bar]
def t_9 := ...t_9... ["defrec", 9, ...["ibid", 9]...]
Personal tools
more tools