wxGoldParser is an engine for GOLD Parser written in C++ for wxWidgets. Unlike common compiler-compilers, the GOLD Parser does not require you to embed your source code directly into the grammar. Instead, the application analyzes the grammar and then saves the parse tables to a separate file. This file can be subsequently loaded by different engines (in different languages), and now also used in wxWidgets. The wxWidgets engine is ported from the Delphi 5 version from Alexandre Rai, and slightly modified to run faster and to be used easier and more reliable under wxWidgets. The Delphi example code is almost ported 100% to wxWidgets to show others which parts of the code are changed, and ofcourse to see if the engine would give the desired result. The source can be downloaded from here and contains:
The wxGoldParser engine is grammar independent, which means if you download a ready made compiled grammar file (for any language you want) it can handle it right away. Simply use the skeleton templates to generate a ready to go class and header file for your parser. Check out the formula parser example inside the source to see how to use it (it uses a skeleton program). wxGoldParser is freeware and distributed under the wxWidgets license. The following screenshots show the Grammar Tester:
The following screenshots show the formula parser:
Latest changes
Todo list
The skeleton tempates are located in the samples/engine directory in the wxGoldParser source. To use the latest ones, copy these to the GOLD Parser's template directory. In the program, after you compiled your grammar or loaded a compiled grammar, select "Create a skeleton program" and select the wxGoldParser skeletons (there are two you need to do!) to generate the code. After generating the code, modify the .cpp file to include the proper file you generated. Unfortunately GOLD Parser only generates one file a time so it's not aware of the proper header file name. If you forget to do it, there is an error pragma notifying you of this issue.
|