Func defination component

/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
enum keywords
{
  TYPEDEF,
  EXTERN,
  STATIC,
  AUTO,
  REGISTER,
  CONST,
  VOLATILE,
  VOID,
  CHAR,
  SHORT,
  INT,
  LONG,
  FLOAT,
  DOUBLE,
  SIGNED,
  UNSIGNED,
  STRUCT,
  UNION,
  ID
};

int arr[15];
char* arr[15];
int tok;


void nextToken()
{
   static int i =0;
   tok = arr[i];
   i++;  
}


void declaration_specifiers()
{
    if(tok == TYPEDEF || tok == EXTERN || tok == STATIC || tok == AUTO || tok == REGISTER)
    {
      nextToken();   
    }
    if(tok == CONST ||
      tok == VOLATILE)
    {
        
       nextToken(); 
    }
    
    if(tok == VOID || 
       tok == CHAR ||
       tok == SHORT || 
       tok == INT ||
       tok == LONG ||
       tok == FLOAT ||
       tok == DOUBLE ||
       tok == SIGNED ||
       tok == UNSIGNED
       )
       {
          nextToken(); 
       }
      
    /*  if(tok == STRUCT ||
         tok == UNION)
      {
          struct_or_union();
      } */
   return;
}
void extra_declarator()
{
    if(tok == '[')
    {
        
    }
    else if(tok == '(')
    {
        
    }
    else
      return;
      
    if(tok != NULL)
     extra_declarator();
}
void declarator()
{
    if(tok == ID)
    {
        
    }
    
    if(tok == '[')
    {
        
        
    }
    else if(tok == '(')
    {
        
        
    }
    else
      return;
    
    if(tok != NULL)
      extra_declarator();
    
}
void statement_list()
{
    
}
void compound_statement()
{
    if(tok == '{')
    {
        //statement_list();
        if(tok == '}')
        {
            
        }
    }
    
}


void function_definition()
{
    declaration_specifiers();
    declarator();
    compound_statement();

}


int main()
{
    arr[0] = STATIC;
    arr[1] = INT;
    arr[2] = ID;
    arr[3] = '(';
    arr[4] = ')';
    arr[5] = '{';
    arr[6] = '}';
     function_definition();
    return 0;
}

Comments