Unfortunately I have to parse a language (JScript). I started to study how to use Flex knowing that Qt is providing a useful tool called QLALR in order to generate parser.
In \util\qlalr\examples\qparser I found a very interesting example integrating a flex generated scanner and qlalr generated parser. Also, from what I understood (but it couldn't be true...) the example introduces a useful QParser interface to avoid to rewrite parse function. In order to compile it I had to download a unistd.h for windows from http://sourceforge.net/projects/gnuwin32/files/flex/2.5.4a-1/flex-2.5.4a-1-lib.zip/download. It is in the directory include. In any case is nothing more than:
This file is part of the Mingw32 package.
unistd.h maps (roughly) to io.h
Using this file I was able to compile the qparser example but when I run it I get a crash before entering in main function with error message: The program ' qparser.exe: Native' has exited with code 2 (0x2).
I'm getting also the following warning messages:
@1>lex.calc.c(903) : warning C4003: not enough actual parameters for macro 'calcwrap'
1>lex.calc.c(1056) : warning C4018: '<' : signed/unsigned mismatch
1>lex.calc.c(1238) : warning C4003: not enough actual parameters for macro 'calcwrap'
1>lex.calc.c(1402) : warning C4996: 'isatty': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _isatty. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(312) : see declaration of 'isatty'
1>lex.calc.c(1402) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(722) : see declaration of 'fileno'
1>LINK : debug
qparser.exe not found or not built by the last incremental link; performing full link@
I'm using Visual Studio 2008 on Windows 7 and Qt 4.8.0 compiled from the same package where I got QLALR.