wxGoldParser based interpreter? Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
lollisoft
Earned some good credits
Earned some good credits
Posts: 115
Joined: Sat Jul 23, 2005 3:52 pm
Location: Germany
Contact:

wxGoldParser based interpreter?

Post by lollisoft » Sat Mar 05, 2011 2:18 pm

Hi,

I am playing around a bit with the GOLD parser and as I am using wxWidgets, I also play with the wxGoldParser engine. But when creating a skeleton, I am not really having a thing to be usable.

It is clear to me to fill the several rules with real code, but I don't know how to start. I may fiddle it out but that may cost very much time.

My idea would be looking in an existing implementation that should at least have support for calling into precompiled functions or filling a 'result' into precompiled variables. What I mean is an interface from within the script to my code.

OTOH there are tools like swig, but I am not that familiar with it. Also I don't like to create a full blown language or use any such.

I am a little familiar with Lex & Yacc and also have written an interpreter by hand many years ago :-)
I wan't to select a parser construction tool that keeps the work as little as possible.

My plans are to use an interpreter to enhance my database prototyping tool with business rules and actions that are alternatively written in interpreted code rather than designed UML activity diagrams.

Are there any such projects I can have a look?

Thanks, Lothar
OS: Windows 7, Mac OS X (Panther/Leopard/Snow Leopard), SuSE Linux, Debian (PPC), OpenMoko FreeRunner
Compiler: OpenWatcom, GCC
wxWidgets 2.8.x
IDE Makefile based.
RAD My own brewed, Code generation with XSLT and DialogBlocks

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Tue Mar 08, 2011 10:53 pm

Hi Lothar,

I made the wxGoldParser engine, which is a direct port of the Delphi version. However in the Delphi engine, there was a nasty bug, which I could not fix, so I pulled the version offline to avoid people getting frustrated with it.

I know there are not much wrappers that are directly useful, you have a big state machine and every token you can perform an action but you have to push your own data into a stack, for example, the epxression will be parsed first, that expression needs to be stored, and it might be used in an assign statement, or a method call. It is your responsibility to handle that. Every wrapper for the GoldParser engine works like that. Since it is an anstract syntax tree, the syntax part is already taken care of so the error handling is minimal, only the variable resolving and other dynamic aspects need to be taken care of.

I used wxGoldParser and it's Delpi counterpart in some projects and was quite succesful implementing the parser with this scope in mind.

With regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

Post Reply