Grammar Overview
ZGL is a data interchange language (also known as a data exchange language).
Here is an example-based overview to ZGL:
element | example(s) | note |
---|---|---|
boolean |
true
false
|
|
integer |
23
0x17
0b10001
|
|
float |
2.7182
3.0e8
|
|
string |
"a gifted raconteur" #"dijo "¡cuidado!"#
|
|
date |
2021-03-18
|
|
datetime |
2021-03-18T16:31:00-04:00
|
|
URL |
https://www.zg-lang.org
|
① |
expression delimiter | ,
| ② |
list |
[5, 12, "thirteen"]
|
③ |
set |
#{"Picard", "Ryker", "Data"}
|
③ |
map |
{"x": 3, "y": 4, "z": 5}
|
③ |
quantity |
<2.54 cm>
<1.21 gigawatts>
|
④ |
variable |
born_in
|
|
entity name |
/person/Mark_Twain |
|
path |
core
::units::metric
|
|
item terminator | ;
| |
use |
:use ::history::Roman;
|
|
bind |
π = 3.14159; ZGL = /language/Z_Graph_Language; |
⑤ |
alias |
:alias /person/FDR /person/Franklin_Delano_Roosevelt;
|
⑥ |
graph |
ZGL homepage https://www.zg-lang.org ;
|
① |
graph with group |
|
Notes
① URLs must be terminated with whitespace. See decision log.
② Trailing commas are allowed.
③ Lists, sets, and maps are heterogenous collections.
④ Quantities are scalars.
⑤ =
immutably binds a value to a variable.
⑥ Entity ids cannot be accessed directly.
If you want two entity names to point to the same entity id, use :alias
.
⑦ Zero or more entity names may be aliased to each entity id. In other words, not all entity ids have corresponding entity names.