Posts

Showing posts from May, 2024

Token buffer datastructure

 /******************************************************************************                               Online C++ Compiler.                Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ // Dynamic token buffer, can be easily resized using realloc #include <iostream> enum  {     EXPR,     COND,     STMT,     DECL      }; struct TLV {     int token;   // atrribute     int len_tok_value; // length     char *tok_value; // value   }; typedef struct token_buffer // TLV concept {     int type_of_language_elem; // type of expr, cond, decl etc. used in generator     int no_of...