int f([in,string] char * msg);This reads: ``f is a function taking a character string as input and returning an int''.
ident | ::= | (A ... Z | a ... z | _) {A ... Z | a ... z | 0 ... 9 | _} |
integer | ::= | [-] {0 ... 9} [-] 0x {0 ... 9 | a ... f | A ... F} [-] 0 {0 ... 7} |
character | ::= | ' (regular-char | escape-char) ' |
string | ::= | " {regular-char | escape-char} " |
escape-char | ::= | \ (b| n| r| t) |
| | \ (0...7) [0...7] [0...7] |
uuid | ::= | hex8 - hex4 - hex4 - hex4 - hex4 hex4 hex4 |
hex | ::= | 0 ... 9 | a ... f | A ... F |
lexpr | ::= | ident |
| | integer | |
| | character | |
| | true | |
| | false | |
| | string | |
| | sizeof ( type-expr ) | |
| | ( lexpr ) | |
| | lexpr (. | ->) ident | |
| | ( type-expr ) lexpr | |
| | (&| *| !| ~| -| +) lexpr | |
| | lexpr (*| /| %) lexpr | |
| | lexpr (+| -) lexpr | |
| | lexpr (<<| >> | |
| | >>>) lexpr | |
| | lexpr (==| !=| >=| <=| >| <) | |
| | lexpr (&| ^| |) lexpr | |
| | lexpr (&&| ||) lexpr | |
| | lexpr ? lexpr : lexpr |
attributes | ::= | [ attribute { , attribute } ] |
attribute | ::= | ident |
| | ident ( [lexpr] { , [lexpr] } ) | |
| | ident ( uuid ) | |
| | attribute * | |
| | * attribute |
Attribute | Context where it can appear |
abstract | typedef |
bigarray | array type |
camlint | int or long integer type |
compare(fun-name) | typedef |
c2ml(fun-name) | typedef |
errorcheck(fun-name) | typedef |
errorcode | typedef |
finalize(fun-name) | typedef |
fortran | array type with bigarray attribute |
hash(fun-name) | typedef |
ignore | any pointer type |
in | function parameter |
int_default( camlint| nativeint| int32| int64) | interface |
int32 | int or long integer type |
int64 | int or long integer type |
length_is(le1, le2,...) | array type |
long_default( camlint| nativeint| int32| int64) | interface |
managed | array type with bigarray attribute |
ml2c(fun-name) | typedef |
mlname( label-name ) | struct field |
mltype(" caml-type-expr ") | typedef |
nativeint | int or long integer type |
null_terminated | array of pointers |
object | interface |
out | function parameter |
pointer_default( ref| unique| ptr) | interface |
propget | function declaration |
propput | function declaration |
propputref | function declaration |
ptr | any pointer type |
ref | any pointer type |
set | enum type |
size_is(le1, le2,...) | array type |
string | character array or pointer |
switch_is(le) | union type or pointer to union |
switch_type(ty) | union or pointer to union |
unique | any pointer, array, or bigarray type |
uuid( uuid ) | interface |
type-spec | ::= | [unsigned| signed] (int| short| long| char| hyper| long long| __int64) |
| | byte | |
| | float | |
| | double | |
| | boolean | |
| | void | |
| | ident | |
| | wchar_t | |
| | handle_t | |
| | struct ident | |
| | union ident | |
| | enum ident | |
| | struct-decl | |
| | union-decl | |
| | enum-decl | |
declarator | ::= | {*} direct-declarator |
direct-declarator | ::= | ident |
| | ( declarator ) | |
| | direct-declarator [ [const-lexpr] ] |
struct-decl | ::= | struct [ident] { {field-decl} } |
field-decl | ::= | attributes type-spec declarator { , declarator } ; |
union-decl | ::= | union [ident] { {union-case} } |
| | union [ident] switch ( type-spec ident ) { {union-case} } | |
union-case | ::= | {case ident :}+ [field-decl] ; default : [field-decl] ; |
enum-decl | ::= | enum [ident] { enum-case {, enum-case} [,] } |
enum-case | ::= | ident [= const-lexpr] |
function-decl | ::= | attributes type-spec {*} ident ( params ) {quote(ident, string)} |
params | ::= | e |
| | void | |
| | param { , param } | |
param | ::= | attributes type-spec declarator |
constant-decl | ::= | const attributes type-spec {*} ident = const-lexpr ; |
file | ::= | {decl} |
decl | ::= | function-decl ; |
| | constant-decl ; | |
| | struct-decl ; | |
| | union-decl ; | |
| | enum-decl ; | |
| | typedef attributes type-spec declarator { , declarator } ; | |
| | attributes interface ident [ : ident ] { {decl} } | |
| | struct ident ; | |
| | union ident ; | |
| | union switch ( type-spec ident ) ; | |
| | attributes interface ident ; | |
| | import string ; | |
| | quote ( [ident ,] string ) | |
| | cpp_quote ( string ) |