Is there really a Flex++ Scanner?
Question
I'm running on a Debian Squeeze and I get flex/flex++ installed using apt-get install flex.
However I noted that flex++ is just a sym link to flex. So, really exists an "program" flex++ that generate c++ scanners or is just a flex flag that I shoud switch?
Also, the common problem: Many examples on the internet can't "compile" under flex or flex++. Flex give the following error:
test.lex:1: invalid character: %
...
when processing an input with just:
%name Test
what is wrong here?
Flex/Flex++ version is 2.5.35
Solution
There is actually a Flex++ project, but it is separate to the original Flex:
Flex does support generating scanner code for use with C++, but it is classed as experimental (though it has been there for quite some time):
The symlink is explained by the fact that some programs modify their behaviour based on how they are invoked. For compatibility reasons, they check argv[0]
and look at the executable name. For example, when run as flex++
, it can enable the -+
flag for C++ support.
(BusyBox uses this technique to have one binary behave as many separate programs, saving space.)