Skip to content

Commit

Permalink
CapTP AST / data representation and serialization #3
Browse files Browse the repository at this point in the history
  • Loading branch information
zenhack authored and dckc committed Feb 18, 2024
1 parent c68a9c2 commit 200fe33
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions packages/ocproto/lib/ocapn.capnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# ocapn.capnp
@0xcd301da1d95b8242;

struct Value {
union {
## Atoms ##

undefined @0 :Void;
null @1 :Void;
bool @2 :Bool;
float64 @3 :Float64;

unsignedInt @4 :Data;
# Non-negative integer, in big-endian format
negativeInt @5 :Data;
# Negative integer. value is `-1 - n`, where `n`
# is the data interpreted as an unsigned big-endian integer.

string @6 :Text;
byteString @7 :Data;
symbol @8 :Text; # Might be removed, pending #46.

## Containers ##

list @9 :List(Value);

struct @10 :List(StructField);
# Duplicate keys are not allowed; will need to enforce this at a higher level
# of abstraction.

tagged :group {
label @11 :Text;
value @12 :Value;
}

capability @13 :Cap;

error @14 :Error;
}
}

struct StructField {
key @0 :Text;
value @1 :Value;
}

interface Cap {
# TODO
}

struct Error {
# TODO, pending #10.
}

0 comments on commit 200fe33

Please sign in to comment.