The following grammar rules define the syntax of binding hooks:
hook -> `{#' inner `#}'
inner -> `import' ['qualified'] ident
| `context' ctxt
| `type' ident
| `sizeof' ident
| `enum' idalias trans [`with' prefix] [deriving]
| `call' [`pure'] [`unsafe'] idalias
| `fun' [`pure'] [`unsafe'] idalias parms
| `get' apath
| `set' apath
| `pointer' ['*'] idalias ptrkind
| `class' [ident `=>'] ident ident
ctxt -> [`lib' `=' string] [prefix]
idalias -> ident [(`as' ident | `^')]
prefix -> `prefix' `=' string
deriving -> `deriving' `(' ident_1 `,' ... `,' ident_n `)'
parms -> [verbhs `=>'] `{' parm_1 `,' ... `,' parm_n `}' `->' parm
parm -> [ident_1 [`*' | `-']] verbhs [`&'] [ident_2 [`*'] [`-']]
apath -> ident
| `*' apath
| apath `.' ident
| apath `->' ident
trans -> `{' alias_1 `,' ... `,' alias_n `}'
alias -> `underscoreToCase' | `upcaseFirstLetter' | `downcaseFirstLetter'
| ident `as' ident
ptrkind -> [`foreign' | `stable'] ['newtype' | '->' ident]
Identifier ident
follow the lexis of Haskell. They may be enclosed in
single quotes to disambiguate them from C->Haskell keywords.