Re: compiler with bison / flex
On Apr 14, 3:47 pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
Philipp Kraus wrote:
I must create my own programming language. So I download
bison and flex and install them. I had tested bison with C
examples and I can create my files, but I need C++ code.
[..]
I hope this thread isn't off-topic.
It is, sorry. Those tools aren't part of the C++ language.
You should consider asking in the newsgroup for the OS you're
using, or in 'comp.compilers'. Have you tried looking on the
web? What if you just rename your resulting C files (or run
then through a C++ compiler without even renaming)? I know,
there aren't probably the answers you're looking for. It
would be nice to have a command-line switch that would just
generate C++ code for you, but I am not certain there is such
a switch, and discussing tools except the ones directly
related to C++ language, like a compiler, is usually off-topic
here.
FWIW: either bison or flex (or perhaps both, I forget) do have
an option to generate C++. At least the last time I tried it,
it was somewhat antiquitated C++ (#include <iostream.h>, ostream
without a namespace, etc.). But generally, a little bit of
post-processing with sed does the trick (even if you generated
C, and not C++). The only problem is that the post-processing
tends to depend on the version of the tool you're using.
--
James Kanze