{ "Name": "John",
"age": 27,
},
"phoneNumbers": [
{ "type": "home",
"number": "212 555-1234"
},
{ "type": "mobile",
"number": "123 456-7890"
}
],
"children": [],
}
| Expression | |
|---|---|
| Format | Meaning |
| string | variable name |
| number | numeric constant |
| { "const": A } | structured constant or string constant |
| [ T, "op-prefix", A ] | expression with prefix operation, like:* & ++ -- ! ~ - |
| [ T, A, "op-postfix" ] | expression with postfix operator, like:++ -- |
| [ T, A, "op-infix", B ] | general infix expression, like:+ - * / % == != > < >= <=
|
| [ T, A, ":", B ] | array indexing A[B] |
| [ T, A, ".", B, N ] | struct/union member selection |
| [ T, A, "->", B ] | indirect struct/union member selection |
| [ T, A, "?", B, C ] | conditional expression |
| [ T, A, arg-list ] | function call. A is the function name |
| { "function" : function-name } | for assigning a function to a function-pointer |
| Statement | |
|---|---|
| Format | Meaning |
| [ T, A, "=", B ] | Assignment statement. Statements like a += 2 are presented as a = a + 2 and i++ is presented as i = i + 1 |
| [ T, A, arg-list ] | function call |
| {"if": A, "then": statm-list, "else": statm-list } | if-statement |
| {"while": A, "do_": statm-list } | while-statement |
| {"do": statm-list, "while_": A } | do-statement |
| {"for": [ A, B, C ] , "do_": statm-list } | for-statement |
| { "//": "comment" } | comment |
| { "seq": statm-list } | statement sequence. Not used ! |
| { "return": A } | return with value |
| { "var": decl-list } | declaration of variables |
| type-spec | |
|---|---|
| Format | Meaning |
| [ "array", size, typename ] | array with elements of type "type-spec" |
| [ "pt", size, typename ] | pointer to "type-spec" |
| [ "struct", size, decl-list ] | structure definition |
| [ "union", size, decl-list ] | union definition |
| [ "function", size, par-list, return-type ] | used for defining a function pointer |
| [ "alias", size, typename ] | used to define a second name for a type |
| declaration-list | |
|---|---|
| Format | Meaning |
| { name1 : type-spec1, name2 : type-spec2, name3 : type-spec3 } | specify a type for one or more variables |
| typedef list | |
|---|---|
| Format | Meaning |
| { name1 : type-spec1, name2 : type-spec2, name3 : type-spec3 } | Specifies a name for one or more types |
| function definition | |
|---|---|
| Format | Meaning |
| { "function": name, "par": par-list, "return" : return-type, "mod" : mod-list, "body" : statm-list, } | specifies a function par = parameterlist return-type can be void mod = list of modifiers |