I am trying other parser,
Narwhal.
- The parser is provided under BSD-style license.
- The parser uses not BNF but Parsing Expression Grammer (PEG).
- The parser (and PEG) is not LALR/LL and does not separate lexical analyzer and syntax analyzer.
- The parser uses wchar_t.
- The parser generated C source code.
- The parser builds a syntax tree without user-defined closures and procedures.
Tthe official binary version 0.1 depends on VC8 or later because generated source code uses
fopen_s of Secure C Library proposed by Microsoft. But, such dependency was fixed in the version 0.1.2 provided as source code only. Thus, I use the version 0.1.2.
However, there was other issue to use with VC7.1. Although source code generated by the version 0.1.2 can build an execution module, the module caused access violation at parsing. When I debug it, I found that the access violation occurs in
swprintf. Its cause was mismatch of function parameters.
Difference of swprinf sigunature between VC8 and VC7.1
In ISO/IEC9899:1999 (
C99), the second argument of
swprintf is size of the buffer in the first parameter, but in old C library of VC7.1 not supporting the
C99, such size parameter did not exist, which causes the access violation.
Furthermore, in not C but C++ of VC7.1, the second parameter is supported because standard C++ refers to the version
C99 explicitly and requires the compatible library with
C99. So, implementation of VC7.1 uses
#ifdef __cplusplus. As, the parser generates source code in not C++ but C, the access violation occurred.
On the other hand, in VC9, there is not such problem because the second parameter of swprintf has been supported.