6 Ninf-G IDL Specifications



Ninf-G IDL files are processed by CPP(C Pre Processor).
Please pay attention to CPP keywords(ex. "#include").

6.1 Ninf-G IDL keywords

Keywords described below are reserved by Ninf-G. You can't use these words as the name of module, functions or parameters.

6.2 Ninf-G IDL syntax


/* program toplevel */
program:  /* empty */
      | declaration_list
    ;

declaration_list: 
        declaration
      | declaration_list declaration
    ;

declaration:
        "Module" IDENTIFIER ';'
      | "CompileOptions" STRING ';'
      | "Globals" globals_body
      | "Library" STRING ';'
      | "FortranFormat" STRING ';'
      | "FortranStringConvention" IDENTIFIER ';'
      | "Define" interface_definition opt_string option_list interface_body
      | "DefClass" IDENTIFIER opt_string defclass_option_list '{' define_list '}' 
      | "Compiler" STRING ';'
      | "Linker" STRING ';'
    ;

define_list:
        /* empty */
      | define_item
      | define_list define_item
    ;

define_item:
        "DefState" '{' 
      | "DefMethod" interface_definition opt_string
      defmethod_option_list interface_body
    ;

defmethod_option_list:
        /* empty */
      | defmethod_option
      | defmethod_option_list defmethod_option 
    ;

defmethod_option:
        calcorder
    ;

defclass_option_list:
        /* empty */
      | defclass_option
      | defclass_option_list defclass_option 
    ;

defclass_option:
        required
      | backend
      | shrink
      | language
    ;

option_list:
        /* empty */
      | decl_option
      | option_list decl_option 
    ;

decl_option:
        required
      | backend
      | shrink
      | calcorder
      | language
    ;

interface_definition: 
        IDENTIFIER '(' parameter_list ')'
      | IDENTIFIER '(' parameter_callback_list ')'
      | IDENTIFIER '(' callback_list ')'
    ;

callback_list:
        callback
      | callback_list ',' callback
    ;

parameter_callback_list:
        parameter_list ',' callback
      | parameter_callback_list ',' callback
    ;

parameter_list: 
        /* empty */ 
      | parameter
      | parameter_list ',' parameter
    ;

callback:
        IDENTIFIER '(' parameter_list ')'
    ;

parameter:
        decl_specifier declarator
    ;

decl_specifier: 
        mode_specifier type_specifier
      | type_specifier mode_specifier
      | type_specifier mode_specifier type_specifier
    ;

type_specifier:
        TYPE
      | TYPE TYPE
      | TYPE TYPE TYPE
    ;

mode_specifier:
        MODE
      | MODE DISTMODE
      | DISTMODE MODE
    ;

declarator:
        IDENTIFIER
      | '(' declarator ')'
      | declarator '['expr_or_null ']'
      | declarator '['expr_or_null ':' range_spec ']'
      | '*' declarator
    ;

range_spec:
        expr     /* upper limit */
      | expr ',' expr     /* lower limit and upper limit */
      | expr ',' expr ',' expr     /* lower, upper and step */
    ;

opt_string: 
        /* empty */
      | STRING 
    ;

required:
        "Required" STRING
    ;

backend:
        "Backend" STRING
    ;

shrink:
        "Shrink" STRING
    ;

language:
        "Language" STRING
    ;

calcorder:
        "CalcOrder" expr
    ;

interface_body:
    '{'  /* C statements */ '}'
    | "Calls" opt_string IDENTIFIER '(' id_list ')' ';'
    ;

globals_body:
    '{'  /* C statements */ '}'
    ;

id_list: IDENTIFIER
    | id_list ',' IDENTIFIER
    | /* empty */
    ;


/* index description */
expr_or_null: 
    expr 
    | /* empty */
    ;

expr:        
     unary_expr
    | expr '/' expr
    | expr '%' expr
    | expr '+' expr
    | expr '-' expr
    | expr '*' expr
    | expr '^' expr
    | expr '<'  expr
    | expr "<=" expr
    | expr ">'  expr
    | expr ">=" expr
    | expr "!=" expr
    | expr "==" expr
    | expr '?' expr ':' expr
    ;

unary_expr:
      primary_expr
    | '*' expr
    | '-' expr
    ;

primary_expr:
     primary_expr '[' expr ']'
    | IDENTIFIER
    | CONSTANT
    | '('  expr  ')'
    ;

/* TYPE = int, char, short, long, long float, double string scomplex dcomplex filename */
/* MODE = IN, OUT, INOUT, WORK */
/* DISTMODE = allocate broadcast */
/* IDENTIFIER = name */
/* CONSTANT = integer literals, floating point literals */
/* STRING = "..." */

6.3 IDL sample

6.4 Example of output results


last update : $Date: 2008-11-11 18:22:06 +0900 (火, 11 11月 2008) $