I'm making a parse tree in Bison. Currently I have one class for each non-terminal and one subclass for each production. The problem is that I have one header for each class, so they are a lot. The solution I thought is to made a common header that includes all the headers.
Example of current project structure:
-ast
--program.hh
--decl.hh
--..
--..
--..
--constants.hh
The common header (say common_header.hh
) looks like:
#ifndef COMMON_HEADER_HH
#define COMMON_HEADER_HH
#include "program.hh"
#include "decl.hh"
// a lot of includes here
#include "constants.hh"
#endif //COMMON_HEADER_HH
So in Bison I just include #include "common_header.hh"
, the problem is that I read that this is considered bad practice because it can produce an overhead and increment compilation times. Is this case justified to make this? The parser will always use all the headers.