I've just kicked back into programming again after a few years off and am toying with your products (GPPG/GPLEX), perhaps with the option of making some new languages. They're great fun to play with and pretty clearly coded - so easy to follow. The first
thing I wanted to do was take your two demo projects and adapt them with Babel to create a syntax highlighting add-in for Visual Studio 10. The good news is I managed to put the two projects together and the .lex and .y files are now glowing green, blue and
red. Unfortunately, it was much harder than it really should have been.
Most things I can hack around, but one needs a change to the toolchain (which I can do, but then I've using a branched toolset).
The worst issue is the namespace collisions that occur when Babel code and GPLEX code meet. They share many of the same class names and definitions, which for the most don't clash. There are some clashes though - the worst being in Scanner.cs - the
generated lexer code. When you enable Babel and set the define in your project you get a line similar to
internal sealed partial class Scanner : ScanBase, IColorScan
The problem is that IColorScan resolves to a copy within the QUT code, and when this routine is called
public LineScanner ()
this.lex = new QUT.GPGen.Lexers.Scanner ();
it expects Scanner to be implementing Babel.ParserGenerator.IColorScan. This prevents me from allowing the build system to re-create the Scanner.cs each time because I have to apply this tweak every time.
A second collision seems to occur on the ShiftReduceParser, one of which is supplied by Babel. I managed to find it and switch it off, but it would be better if there was no conflict.
Finally, I had to make numerous little fix-ups in Babel and the invariant part of GPLEX/GPPG in order to make them play nice. Most involved dis-disambiguating which class an object was - or moving from a Babel specific version of a class to the more applicable
GPLEX/GPPG version. I'm aware both projects are moving targets right now, so am loathe to make a swathe of changes which will just need to be applied again then patches come out. Still, I'd be happy to contribute patches to your project.
The good news is, I managed to get both extensions written, and quickly too (2 days), and I'm happy to pass on either the code or the extensions for anyone wanting syntax highlighting while they hack their .lex and .y files.