If you are attempting to develop a small language, you really need to get
a good bit of background on the interaction between flex, bison, and applications...
Flex is used to generate C code (or C++) for a scanner from a specification file.
Bison is used tp generate C code (or C++) for a parser from a specification file.
As a side effect, the generated C/C++ allows for a parser that may use a scanner
from flex or a hand crafted scanner.
None of this goes on to address the application (whether a data processing
application or a compiler).
After compiling all source files (scanner - which may have multiple files, parser -
which again may/will have multiple files, and application - still more source files)
the final executable is generated with the system linker. This is invoked either
directly, or as part of the C/C++ compiler sequence. This usually involve make,
and a lot of libraries (which is why the program development group install is so
Some of your questions indicate the lack of a development background - I suggest
the textbook "lex & yacc, Second Edition"
which has a number of examples that will help. Besides, I found that the subject is
sufficiently complex that I refer back to it whenever I start another such project. I
just don't remember all of the nuances to the subject.
One of the reasons I prefer flex/bison over lex/yacc is that I sometimes have
situations where I may be scanning/parsing two different files, or the same file
with sections containing different languages... requiring two or more parsers
and scanners. flex/bison allows for this, lex/yacc does not. Flex/Bison are
also more portable in that flex/bison run on more platforms than does lex/yacc.