Posts

Commons_2.h

#pragma once #include <stdlib.h> #include <stdio.h> #include <string.h> // expression related words, which needs to be removed as lexer already has  enum expr {     ELIF,     ADD_ASSIGN,     INC_OP,     SUB_ASSIGN,     DEC_OP,     DIV_ASSIGN,     MUL_ASSIGN,     MOD_ASSIGN,     AND_ASSIGN,     XOR_ASSIGN,     OR_ASSIGN,     NOT_ASSIGN,     RIGHT_OP,     LEFT_OP,     EQ_EQ_COND,     GRT_EQ_OP,     LESR_EQ_OP,     INT_CONST,     CHAR_CONST,     F_CONST,     OCTAL_CONST,     USIGN_INT_CONST,     LONG_INT_CONST,     LONG_DOUBLE_CONST,     E_F_CONST }; enum keywords {     TYPEDEF,     EXTERN,     STATIC,     AUTO,     REGISTER,     CONST,     VOLATILE, ...

SNR Parser_2.c

 /*   Stackless Non-Recursive(SNR) Parser for C language    2024 Copyright@ Daipayan Bhowal  */ #include <stdio.h> #include "commons.h" #include <stdlib.h> void function_caller(_bool*); void declaration_specifiers(_bool* is_decl_sp, int* type); void args(_bool* is_args); void block_start_statement(_bool* is_blk); enum parser_check // enum is used for indexing the different types of language elements such as expr, stmt, func_def {     START_INDEX,     is_mdecl,     is_func_def,     is_func_decl,     is_blk_end,     is_enum_def,     is_enum_func_def,     is_enum_func_decl,     is_struct_def,     is_struct_dcl,     is_struct_fun_def,     is_struct_fun_dcl,     is_func_caller,     MAX_SIZE }; _bool parsing_check[MAX_SIZE + 1] = { FALSE }; // for checking if any one of parsing is successful int startToken[MAX_SIZE + 1...