-

0 -

0 -

26 -

4
120 plików
4,74 GB
Ostatnio pobierane pliki
Przez jakiś czas myślałem nad WebAssembly ale jak tak się zastanowić …
Powiedzmy, że chcę udostępnić API, które wykona proste dodawanie:
a = 2
if a+a == 4
dodawanie = a+a
Chcę mieć możliwość zapamiętywania zmiennych po stronie serwera. Później będzie można wyświetlić wybraną zmienną po nazwie + jej wartość.
JSON:
{
"vars": [
{
"id": "a",
"value": 2
}
],
"operations": [
{
"id": "a",
"addition": 2
}
],
"control": [
{
"id": "a",
"If": [
{
"eq": 4
}
],
"than": {
"id": "dodawanie",
"print": "dodawanie"
}
}
]
}
Schema:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Math",
"definitions": {
"Math": {
"type": "object",
"additionalProperties": false,
"properties": {
"vars": {
"type": "array",
"items": {
"$ref": "#/definitions/Var"
}
},
"operations": {
"type": "array",
"items": {
"$ref": "#/definitions/Operation"
}
},
"control": {
"type": "array",
"items": {
"$ref": "#/definitions/Control"
}
}
},
"required": [],
"title": "Math"
},
"Control": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"If": {
"type": "array",
"items": {
"$ref": "#/definitions/If"
}
},
"than": {
"$ref": "#/definitions/Than"
}
},
"required": [],
"title": "Control"
},
"If": {
"type": "object",
"additionalProperties": false,
"properties": {
"gt": {
"type": "integer"
},
"gte": {
"type": "integer"
},
"eq": {
"type": "integer"
},
"lte": {
"type": "integer"
},
"lt": {
"type": "integer"
},
"spaceship": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
}
},
"required": [],
"title": "If"
},
"Than": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"print": {
"type": "string"
}
},
"required": [],
"title": "Than"
},
"Operation": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"addition": {
"type": "integer"
},
"subtraction": {
"type": "integer"
},
"multiplication": {
"type": "integer"
},
"exponentiation": {
"type": "integer"
},
"division": {
"type": "number"
},
"floor_division": {
"type": "integer"
},
"modulus": {
"type": "integer"
},
"abs": {
"type": "integer"
},
"divmod": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"round_mode": {
"type": "integer"
}
},
"required": [],
"title": "Operation"
},
"Var": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"value": {
"type": "integer"
}
},
"required": [],
"title": "Var"
}
}
}
Nie ma plików w tym folderze
-

0 -

0 -

0 -

0
0 plików
0 KB
Chomikowe rozmowy










Pokaż wszystkie
Pokaż ostatnie
