Accessibility issues in compiling gppg

Jun 26, 2012 at 12:58 AM

Hi,

I've managed to write a .lex and .y file and compile them fine with gplex and gppg, using the /gplex option in gppg.  I've imported them into my C# project (along with the gplex and gppg source), but upon compiling, I get the error:

 

Inconsistent accessibility: base class 'QUT.Gppg.ShiftReduceParser<MyLanguage.ValueType,QUT.Gppg.LexLocation>' is less accessible than class 'MyLanguage.Parser'
Now, I could go through the code and change these accessibilities, but isn't this something I shouldn't have to do? Is there a fix for this in the code generation process?
Thanks!  Other than this minor inconvenience, the tools have been wonderful!
Andrew
Coordinator
Jun 26, 2012 at 11:12 PM

Hi Andrew.

The visibility of the Parser class in controlled by the %visibility declaration in the *.y file.  The visibility of the generic base class is public if you access it from the dll, or is controlled by a pre-processer symbol if you use the ShiftReduceParserCode.cs source.  If you declare "%visibility internal" everything should just work.  Alternatively, if you must have public accessibility for the parser class then compile with symbol EXPORT_GPPG defined, or reference the ShiftReduceParser.dll rather than include the source code in your project.

Sorry it is so complicated, but there are many different encapsulation scenarios here.  There is more discussion in section 5.1 Runtime Shift-Reduce Engine in the documentation.  However, in any case you should never have to modify the generated scanner/parser output.

Let me know if you still have problems

John

Jun 27, 2012 at 6:02 PM

This worked perfectly!  I didn't even notice the precompiled DLL in the binaries folder -- thought I had to build it myself.  Thanks for the quick response.

Andrew