PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Ion

Ion

Ion is an idl created in 2016.

#423on PLDB 6Years Old 1Books
0Papers

Amazon Ion is a richly-typed, self-describing, hierarchical data serialization format offering interchangeable binary and text representations. The text format (a superset of JSON) is easy to read and author, supporting rapid prototyping. The binary representation is efficient to store, transmit, and skip-scan parse.


Example from the web:
/* Ion supports comments. */ // Here is a struct, which is similar to a JSON object { // Field names don't always have to be quoted name: "Fido", // This is an integer with a 'years' annotation age: years::4, // This is a timestamp with day precision birthday: 2012-03-01T, // Here is a list, which is like a JSON array toys: [ // These are symbol values, which are like strings, // but get encoded as integers in binary ball, rope, ], // This is a decimal -- a base-10 floating point value weight: pounds::41.2, // Here is a blob -- binary data, which is // base64-encoded in Ion text encoding buzz: {{VG8gaW5maW5pdHkuLi4gYW5kIGJleW9uZCE=}}, }

Language features

Feature Supported Example Token
MultiLine Comments
/* A comment
*/
/* */
Line Comments
// A comment
//
Lists
null.list         // A null list value
[]                // An empty list value
[1, 2, 3]         // List of three ints
[ 1 , two ]       // List of an int and a symbol
[a , [b]]         // Nested list
[ 1.2, ]          // Trailing comma is legal in Ion (unlike JSON)
[ 1, , 2 ]        // ERROR: missing element between commas
Strings
"hello world"
Multiline Strings
( '''hello '''     // Sexp with one element
  '''world!'''  )

("hello world!")   // The exact same sexp value

// This Ion value is a string containing three newlines. The serialized
// form's first newline is escaped into nothingness.
'''\
The first line of the string.
This is the second line of the string,
and this is the third line.
'''
Integers
// http://amzn.github.io/ion-docs/docs/spec.html
null.int   // A null int value
0          // Zero.  Surprise!
-0         //   ...the same value with a minus sign
123        // A normal int
-123       // Another negative int
0xBeef     // An int denoted in hexadecimal
0b0101     // An int denoted in binary
1_2_3      // An int with underscores
0xFA_CE    // An int denoted in hexadecimal with underscores
0b10_10_10 // An int denoted in binary with underscores
Assignment
// A subset of symbols called identifiers can be denoted in text without single-quotes. 
Floats
// http://amzn.github.io/ion-docs/docs/spec.html
-0.12e4           // Type is float
Structs
{ first : "Tom" , last: "Riddle" }  // Structure with two fields
{"first":"Tom","last":"Riddle"}     // The same value with confusing style
{center:{x:1.0, y:12.5}, radius:3}  // Nested struct
Comments
Booleans
null.bool
true
false
Semantic Indentation ϴ

Books about Ion from ISBNdb

title authors year publisher
Pumps, Transporters, and Ion Channels (Lecture Notes in Computer Science) 2008 Springer
dogescript.html · ion.html · k.html

View source

PLDB - Build the next great programming language · v2022 · Day 32 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com