Michelson (docs): rewrite intro + doc fixes.

This commit is contained in:
Benjamin Canou 2017-01-11 15:21:11 +01:00
parent 6bfbb0d300
commit 98859dbf30
2 changed files with 617 additions and 428 deletions

View File

@ -19,7 +19,7 @@ introspecting the node, returning the current state of the storage.
"retType": /* type */, "retType": /* type */,
"storageType": /* type */ }, "storageType": /* type */ },
"storage": "storage":
{ "storage": /* tagged data */, { "storage": /* data */,
"storageType": /* type */ } } "storageType": /* type */ } }
All the sub fields contain expressions in a common meta JSON format All the sub fields contain expressions in a common meta JSON format
@ -61,7 +61,8 @@ application of a primitive.
"name" "name"
The name of the primitive is expected to be in lowercase. The name of the primitive must respect the same case policy as the
concrete sytax.
### Examples ### Examples
@ -69,56 +70,19 @@ Originating a contract with a script that does nothing can be done
with the following JSON script description. with the following JSON script description.
{ "code": { "code":
{ "code": [ "cdr", { "code": [ "CDR",
{ "push": [ "void" ] } { "PUSH": [ "uint8", { "int": "3" } ] }
"pair" ], "PAIR" ],
"argType": "void", "argType": "unit",
"retType": "void", "retType": "uint8",
"storageType": "void" }, "storageType": "unit" },
"storage": "storage":
{ "storage": "void", { "storage": "unit",
"storageType": "void" } } "storageType": "unit" } }
### Full grammar ### Full grammar
/* tagged data */ ::= /* data */ ::=
| { "int8": [ /* int constant */ ] }
| { "int16": [ /* int constant */ ] }
| { "int32": [ /* int constant */ ] }
| { "int64": [ /* int constant */ ] }
| { "uint8": [ /* int constant */ ] }
| { "uint16": [ /* int constant */ ] }
| { "uint32": [ /* int constant */ ] }
| { "uint64": [ /* int constant */ ] }
| "void"
| "true"
| "false"
| /* string constant */
| /* float constant */
| { "timestamp": [ /* timestamp constant */ ] }
| { "signature": [ /* signature constant */ ] }
| { "tez": [ /* tez constant */ ] }
| { "key": [ /* key constant */ ] }
| { "left": [ /* tagged data */, /* type */ ] }
| { "right": [ /* type */, /* tagged data */ ] }
| { "or": [ /* type */, /* type */, /* untagged data */ ] }
| { "some": [ /* tagged data */ ] }
| { "some": [ /* type */, /* untagged data */ ] }
| { "none": [ /* type */ ] }
| { "option": [ /* type */, /* untagged data */ ] }
| { "pair": [ /* tagged data */, /* tagged data */ ] }
| { "pair": [ /* type */,
/* type */,
/* untagged data */,
/* untagged data */ ] }
| { "list": [ /* type */, /* untagged data */ ... ] }
| { "set": [ /* comparable type */, /* untagged data */ ... ] }
| { "map": [ /* comparable type */,
/* type */,
{ "item": [ /* untagged data */, /* untagged data */ ] } ... ] }
| { "contract": [ /* type */, /* type */, /* contract constant */ ] }
| { "lambda": [ /* type */, /* type */, [ /* instruction */ ... ] ] }
/* untagged data */ ::=
| /* int constant */ | /* int constant */
| /* string constant */ | /* string constant */
| /* float constant */ | /* float constant */
@ -127,94 +91,94 @@ with the following JSON script description.
| /* key constant */ | /* key constant */
| /* tez constant */ | /* tez constant */
| /* contract constant */ | /* contract constant */
| "void" | "Unit"
| "true" | "True"
| "false" | "False"
| { "pair": [ /* untagged data */, /* untagged data */ ] } | { "Pair": [ /* data */, /* data */ ] }
| { "left": [ /* untagged data */ ] } | { "Left": [ /* data */ ] }
| { "right": [ /* untagged data */ ] } | { "Right": [ /* data */ ] }
| { "some": [ /* untagged data */ ] } | { "Some": [ /* data */ ] }
| "none" | "None"
| { "list": [ /* untagged data */ ... ] } | { "List": [ /* data */ ... ] }
| { "set": [ /* untagged data */ ... ] } | { "Set": [ /* data */ ... ] }
| { "map": [ { "item": [ /* untagged data */, /* untagged data */ ] } ... ] } | { "Map": [ { "item": [ /* data */, /* data */ ] } ... ] }
/* instruction */ ::= /* instruction */ ::=
| [ /* instruction */ ... ] | [ /* instruction */ ... ]
| "drop" | "DROP"
| "dup" | "DUP"
| "swap" | "SWAP"
| { "push": [ /* tagged data */ ] } | { "PUSH": [ /* type */ /* data */ ] }
| "some" | "SOME"
| { "none": [ /* type */ ] } | { "NONE": [ /* type */ ] }
| { "if_none": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] } | { "IF_NONE": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] }
| "pair" | "PAIR"
| "car" | "CAR"
| "cdr" | "CDR"
| { "left": [ /* type */ ] } | { "LEFT": [ /* type */ ] }
| { "right": [ /* type */ ] } | { "RIGHT": [ /* type */ ] }
| { "if_left": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] } | { "IF_LEFT": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] }
| { "nil": [ /* type */ ] } | { "NIL": [ /* type */ ] }
| "cons" | "CONS"
| { "if_cons": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] } | { "IF_CONS": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] }
| { "empty_set": [ /* type */ ] } | { "EMPTY_SET": [ /* type */ ] }
| { "empty_map": [ /* comparable type */, /* type */ ] } | { "EMPTY_MAP": [ /* comparable type */, /* type */ ] }
| "map" | "MAP"
| "reduce" | "REDUCE"
| "mem" | "MEM"
| "get" | "GET"
| "update" | "UPDATE"
| { "if": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] } | { "IF": [ [ /* instruction */ ... ], [ /* instruction */ ... ] ] }
| { "loop": [ [ /* instruction */ ... ] ] } | { "LOOP": [ [ /* instruction */ ... ] ] }
| { "lambda": [ /* type */, /* type */, [ /* instruction */ ... ] ] } | { "LAMBDA": [ /* type */, /* type */, [ /* instruction */ ... ] ] }
| "exec" | "EXEC"
| { "dip": [ [ /* instruction */ ... ] ] } | { "DIP": [ [ /* instruction */ ... ] ] }
| "fail" | "FAIL"
| "nop" | "NOP"
| "concat" | "CONCAT"
| "add" | "ADD"
| "sub" | "SUB"
| "mul" | "MUL"
| "div" | "DIV"
| "abs" | "ABS"
| "neg" | "NEG"
| "mod" | "MOD"
| "lsl" | "LSL"
| "lsr" | "LSR"
| "or" | "OR"
| "and" | "AND"
| "xor" | "XOR"
| "not" | "NOT"
| "compare" | "COMPARE"
| "eq" | "EQ"
| "neq" | "NEQ"
| "lt" | "LT"
| "gt" | "GT"
| "le" | "LE"
| "ge" | "GE"
| "cast" | "CAST"
| "checked_abs" | "CHECKED_ABS"
| "checked_neg" | "CHECKED_NEG"
| "checked_add" | "CHECKED_ADD"
| "checked_sub" | "CHECKED_SUB"
| "checked_mul" | "CHECKED_MUL"
| "checked_cast" | "CHECKED_CAST"
| "floor" | "FLOOR"
| "ceil" | "CEIL"
| "inf" | "INF"
| "nan" | "NAN"
| "isnan" | "ISNAN"
| "nanan" | "NANAN"
| "manager" | "MANAGER"
| "transfer_funds" | "TRANSFER_FUNDS"
| "create_account" | "CREATE_ACCOUNT"
| "create_contract" | "CREATE_CONTRACT"
| "now" | "NOW"
| "amount" | "AMOUNT"
| "balance" | "BALANCE"
| "check_signature" | "CHECK_SIGNATURE"
| "h" | "H"
| "steps_to_quota" | "STEPS_TO_QUOTA"
| { "source": [ /* type */, /* type */ ] } | { "SOURCE": [ /* type */, /* type */ ] }
/* type */ ::= /* type */ ::=
| "int8" | "int8"
| "int16" | "int16"
@ -224,7 +188,7 @@ with the following JSON script description.
| "uint16" | "uint16"
| "uint32" | "uint32"
| "uint64" | "uint64"
| "void" | "unit"
| "string" | "string"
| "float" | "float"
| "tez" | "tez"
@ -237,7 +201,7 @@ with the following JSON script description.
| { "set": [ /* comparable type */ ] } | { "set": [ /* comparable type */ ] }
| { "contract": [ /* type */, /* type */ ] } | { "contract": [ /* type */, /* type */ ] }
| { "pair": [ /* type */, /* type */ ] } | { "pair": [ /* type */, /* type */ ] }
| { "union": [ /* type */, /* type */ ] } | { "or": [ /* type */, /* type */ ] }
| { "lambda": [ /* type */, /* type */ ] } | { "lambda": [ /* type */, /* type */ ] }
| { "map": [ /* comparable type */, /* type */ ] } | { "map": [ /* comparable type */, /* type */ ] }
/* comparable type */ ::= /* comparable type */ ::=

File diff suppressed because it is too large Load Diff