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:
      | DEFINE interface_definition opt_string option_list
        interface_body
      | DEFCLASS IDENTIFIER opt_string defclass_option_list '{'
        define_list '}' 
    ;

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
      { $$ = $1;}
    ;

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:
    { $$ = NULL; }
    |  parameter
    | parameter_list ',' parameter
    ;

callback:
       IDENTIFIER '(' parameter_list ')'
    ;

parameter: 
       decl_specifier declarator
    ;

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

type_specifier:
      TYPE
    | TYPE TYPE
    | TYPE TYPE TYPE /* ex. unsigned long int */
    ;

mode_specifier:
    MODE
    | MODE DISTMODE
    | DISTMODE MODE
    ;

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

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

opt_string: 
    /* empty */ 
    | STRING 
    ;

required:
    /* empty */ 
    | ``Required'' STRING
    ;

backend:
    /* empty */ 
    | ``Backend'' STRING
    ;

shrink:
    /* empty */ 
    | "Shrink" STRING
    ;
 
language: 
    /* empty */ 
    | ``fortran''
    | ``C++''
    | ``C''
    ;

calcorder:
    /* empty */ 
    | ``CalcOrder'' STRING
    ;

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

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

id_list: IDENTIFIER
    | id_list ',' IDENTIFIER
    | { $$ = NULL; }
    ;

/* index description */

expr_or_null: 
       expr 
    | /* null */
    ;

expr:
      unary_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, unsigned, char, short, long, long float, double */
/* MODE = IN, OUT, INOUT, WORK */
/* IDENTIFIER = name */
/* CONSTANT = integer literals, floating point literals */
/* STRING = "..." */

6.3 IDL sample

6.4 Example of output results


last update : $Date: 2005/07/08 04:05:07 $