Good tools for creating a C/C++ parser/analyzer [closed]

Parsing C++ is extremely hard because the grammar is undecidable. To quote Yossi Kreinin: Outstandingly complicated grammar “Outstandingly” should be interpreted literally, because all popular languages have context-free (or “nearly” context-free) grammars, while C++ has undecidable grammar. If you like compilers and parsers, you probably know what this means. If you’re not into this kind … Read more

String input to flex lexer

The following routines are available for setting up input buffers for scanning in-memory strings instead of files (as yy_create_buffer does): YY_BUFFER_STATE yy_scan_string(const char *str): scans a NUL-terminated string` YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len): scans len bytes (including possibly NULs) starting at location bytes Note that both of these functions create, return a corresponding YY_BUFFER_STATE … Read more

How to compile LEX/YACC files on Windows?

As for today (2011-04-05, updated 2017-11-29) you will need the lastest versions of: flex-2.5.4a-1.exe bison-2.4.1-setup.exe After that, do a full install in a directory of your preference without spaces in the name. I suggest C:\GnuWin32. Do not install it in the default (C:\Program Files (x86)\GnuWin32) because bison has problems with spaces in directory names, not … Read more

tech