Binding NetBeans with Flex

In my faculty – Informatics Engineering, Damascus University -, in the 4th year of Software Engineering Department, we have to build a compiler :shock:.

I like using NetBeans for developing applications, it supports lots of languages and tools; like C, C++, Java, Python, Ruby and more. The compiler would be implemented in C++.

The first two phases of implementing a compiler are: building a lexer (tokenizer) and building a parser. The lexer is implemented using GNU Flex while the parser is implemented using GNU Bison.

The Problem

The first problem I faced when starting the project was to tell NetBeans how to handle the lex file:

The lex file must be passed to the flex tool to generate a C++ code file.

The second problem was that when the code file is generated it contains errors:

When using building the file you’ll find that it contains errors regarding the usage of istream. (You might not face this problem, then you’re a lucky programmer).
Continue reading “Binding NetBeans with Flex”